blob: 684636cccce4ffce790ac28bbbb743233ba85d61 [file] [log] [blame]
<div class="wiki-content maincontent"><h1>Running an ActiveMQ Broker</h1><p>Note if you want to use an <strong>embedded broker</strong> then see <link><page ri:content-title="How do I embed a Broker inside a Connection"></page></link></p><p>This page describes how to run a broker using 4.x or later of ActiveMQ.</p><h3>Running the broker as a Unix Service</h3><p class="confluence-link">See the&#160; <link><page ri:content-title="Unix Shell Script"></page></link> for details.</p><h3>Running the broker using the Java Service Wrapper Implementation</h3><p>See the&#160;<link><page ri:content-title="Java Service Wrapper"></page><plain-text-link-body>Java Service Wrapper Page</plain-text-link-body></link> for details.</p><h3>Monitoring the broker</h3><p><structured-macro ac:macro-id="f323e9fa-3807-41d2-8105-cef766188784" ac:name="include" ac:schema-version="1"><parameter ac:name=""><link><page ri:content-title="Monitoring ActiveMQ"></page></link></parameter></structured-macro></p><h3>Running the broker inside a Servlet Engine</h3><p>See the source code (or WAR) of the <link><page ri:content-title="Web Console"></page></link> for an example of how to run the broker inside a web application using Spring.</p><h3>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 <link><page ri:content-title="J2EE"></page></link></p><h3>Running the broker from the source code</h3><p>From the latest <link><page ri:content-title="Source"></page><plain-text-link-body>checkout</plain-text-link-body></link> of the code you can run a broker using the <link><page ri:content-title="ActiveMQ Performance Module Users Manual"></page><plain-text-link-body>ActiveMQ Performance Plugin</plain-text-link-body></link></p><h3>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 <link><page ri:content-title="Maven2 ActiveMQ Broker Plugin"></page><plain-text-link-body>here</plain-text-link-body></link></p><structured-macro ac:macro-id="216ea735-8cdd-4322-ac8b-ad8829396ff8" ac:name="code" ac:schema-version="1"><plain-text-body>mvn org.apache.activemq.tooling:maven-activemq-plugin:5.0-SNAPSHOT:run
</plain-text-body></structured-macro><p>You can also include it the pom and run it using:</p><structured-macro ac:macro-id="3d8a1a6a-2884-4381-9b31-256988a19897" ac:name="code" ac:schema-version="1"><plain-text-body>mvn activemq:run
</plain-text-body></structured-macro><h2>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 <link><page ri:content-title="Configuring Transports"></page></link>; briefly...</p><p>Just change your connection URI in 4.x to</p><structured-macro ac:macro-id="aaf9c28a-8b93-4338-87fb-7326c5c154b9" ac:name="code" ac:schema-version="1"><plain-text-body>failover:tcp://host:port
</plain-text-body></structured-macro><p>And the JMS client will auto-reconnect to the broker if it is shutdown and restarted later on.</p></div>