...
The binary distribution of ActiveMQ comes with a script called 'activemq' which allows you to run a broker.
For details regarding the activemq init script file review Unix Shell Script and ActiveMQ Command Line Tools Reference
Typing the following will run an ActiveMQ Broker using the out of the box configuration in the foreground
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 |
|
|
bin/activemq console 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 |
|
|
bin/activemq console 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 |
|
|
bin/activemq console 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 &
|
|
Monitoring the broker
Include Page |
|
|
Running the broker inside a Servlet Engine
See the source code (or WAR) of the Web Console for an example of how to run the broker inside a web application using Spring.
Running the broker inside your J2EE
...
Application Server
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.
...
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
...
There is detailed documentation on this in Configuring version Version 5 Transports; briefly...
Just change your connection URI i to
Codeblock |
failover:tcp://host:port
|
And the JMS client will auto-reconnect to the broker if it is shutdown and restarted later on.