...
This page describes how to run a broker using 4.x or later of ActiveMQ. For earlier versions of ActiveMQ see Running a 3.x Broker
The binary distribution of ActiveMQ comes with a script called 'activemq' which allows you to run a broker. Typing the following will run an ActiveMQ Broker using the out of the box configuration
Codeblock |
activemq
|
There are a number of different command line options to be able to run a broker. To see them type
Codeblock |
activemq -?
|
For more details regarding the activemq script file and other script files refer to ActiveMQ Command Line Tools Reference
You can then use a Broker Configuration URI to specify how to start and configure your broker using a single URI. For example
Codeblock |
activemq broker:(tcp://localhost:61616,network:static:tcp://remotehost:61616)?persistent=false&useJmx=true
|
Or you can a Broker XBean URI to customize the Message Broker using the Xml Configuration to suit your needs. You can run a broker with a specific XML configuration as
Codeblock |
activemq xbean:foo.xml
|
Or you can use a Broker Properties URI to customize the Message Broker using a properties file; which avoids the dependency on Spring, xbean-spring and XML.
Codeblock |
activemq properties:foo.properties
|
Warnung |
|
|
| If you are running a broker on a remote unix machine via telnet/ssh, when you exit your shell the broker will terminate too. If you want to keep the broker running you may want to use the /etc/init.d type services to run the broker. Or try use nohup. e.g.
Codeblock |
nohup activemq > /dev/null &
|
|
...
See the Java Service Wrapper Page for details.
Monitoring the broker
Include Page |
|
|
Running the broker inside a Servlet Engine
...
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 here
Codeblock |
mvn org.apache.activemq.tooling:maven-activemq-plugin:5.0-SNAPSHOT:run
|
You can also include it the pom and run it using:
Codeblock |
mvn activemq:run
|
Handling JMS brokers going down
...
Just change your connection URI in 4.x to
Codeblock |
failover:tcp://host:port
|
And the JMS client will auto-reconnect to the broker if it is shutdown and restarted later on.