blob: 0c3967c86055b62ee0e3d8147a9b76feada460be [file] [log] [blame]
<div class="wiki-content maincontent"><h1 id="RunBroker-RunninganActiveMQBroker">Running an ActiveMQ Broker</h1><p>Note if you want to use an <strong>embedded broker</strong> then see <a shape="rect" href="how-do-i-embed-a-broker-inside-a-connection.xml">How do I embed a Broker inside a Connection</a></p><p>This page describes how to run a broker using 4.x or later of ActiveMQ.</p><h3 id="RunBroker-RunningthebrokerasaUnixService">Running the broker as a Unix Service</h3><p class="confluence-link">See the&#160; <a shape="rect" href="unix-shell-script.xml">Unix Shell Script</a> for details.</p><h3 id="RunBroker-RunningthebrokerusingtheJavaServiceWrapperImplementation">Running the broker using the Java Service Wrapper Implementation</h3><p>See the&#160;<a shape="rect" href="java-service-wrapper.xml">Java Service Wrapper Page</a> for details.</p><h3 id="RunBroker-Monitoringthebroker">Monitoring the broker</h3><p>You can monitor ActiveMQ using the <a shape="rect" href="web-console.xml">Web Console</a> by pointing your browser at</p><p><a shape="rect" class="external-link" href="http://localhost:8161/admin" rel="nofollow">http://localhost:8161/admin</a></p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From ActiveMQ 5.8 onwards the web apps is secured out of the box.<br clear="none"> The default username and password is admin/admin. You can configure this in the conf/jetty-real.properties file.</p></div></div><p>Or you can use the <a shape="rect" href="jmx.xml">JMX</a> support to view the running state of ActiveMQ.</p><p>For more information see the file <code>docs/WebConsole-README.txt</code> in the distribution.</p><h3 id="RunBroker-RunningthebrokerinsideaServletEngine">Running the broker inside a Servlet Engine</h3><p>See the source code (or WAR) of the <a shape="rect" href="web-console.xml">Web Console</a> for an example of how to run the broker inside a web application using Spring.</p><h3 id="RunBroker-RunningthebrokerinsideyourJ2EE1.4ApplicationServer">Running the broker inside your J2EE 1.4 Application Server</h3><p>Whether its Apache Geronmio, JBoss 4, WebLogic 9 or some other J2EE 1.4 container you should be able to just reconfigure and then deploy the activemq-*.rar which is included in the binary distribution as a deployment unit in your app server. By default the rar is not configured to start an embedded broker. But by setting the brokerXmlConfig on the resource adapter configuration, the resource adapter will start an embedded broker.</p><p>For more details see <a shape="rect" href="j2ee.xml">J2EE</a></p><h3 id="RunBroker-Runningthebrokerfromthesourcecode">Running the broker from the source code</h3><p>From the latest <a shape="rect" href="source.xml">checkout</a> of the code you can run a broker using the <a shape="rect" href="activemq-performance-module-users-manual.xml">ActiveMQ Performance Plugin</a></p><h3 id="RunBroker-Runningthebrokerfrommaven">Running the broker from maven</h3><p>You can download and install the ActiveMQ Startup Maven Plugin via the following command if you are in a directory with a pom.xml. More detailed usage <a shape="rect" href="maven2-activemq-broker-plugin.xml">here</a></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[mvn org.apache.activemq.tooling:maven-activemq-plugin:5.0-SNAPSHOT:run
]]></script>
</div></div><p>You can also include it the pom and run it using:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[mvn activemq:run
]]></script>
</div></div><h2 id="RunBroker-HandlingJMSbrokersgoingdown">Handling JMS brokers going down</h2><p>A common requirement is that if the JMS broker goes down you want to automatically detect the failure and try to reconnect under the covers so that your application does not have to worry about reconnection.</p><p>There is detailed documentation on this in <a shape="rect" href="configuring-transports.xml">Configuring Transports</a>; briefly...</p><p>Just change your connection URI in 4.x to</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[failover:tcp://host:port
]]></script>
</div></div><p>And the JMS client will auto-reconnect to the broker if it is shutdown and restarted later on.</p></div>