Apache ActiveMQ ™ -- Running a 3.x Broker
Site > Old Links > Previous Versions > Running a 3.x Broker
The 3.x 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
<![CDATA[ activemq ]]>
You can use the Xml Configuration to customize the Message Broker to suit your needs. You can run a broker with a specific XML configuration as
<![CDATA[ activemq foo.xml ]]>
Running the broker inside a Servlet Engine
If you have the binary distribution (3.1 onwards) you can run the broker using a WAR distribution. From the binary download type the following
<![CDATA[ cd example ant war ]]>
and you get a war in the target directory capable of being deployed in a servlet engine. This has been tried in Resin, Tomcat 4.x, 5.x, Jetty 5.x and should work in most good servlet engines. See the Ant build for details and web.xml of how this works if you wish to integrate this into your WAR.
Running the broker inside your J2EE 1.4 Application Server
Whether its Apache Geronmio, JBoss 4, WebLogic 9 or some other J2EE 1.4 container you should be able to just deploy the activemq-*.rar which is included in the binary distribution as a deployment unit in your app server.
Running the 3.x broker from the source code
You can do this by running the main() in the org.activemq.broker.impl.Main class inside your IDE, assuming you've set up your classpath properly.
Another option, if you have a source distribution, is to run the broker from inside Maven by typing
<![CDATA[ cd modules/assembly maven server ]]>
You can specify a URL to listen on by specifying a parameter, such as
<![CDATA[ java org.activemq.broker.impl.Main tcp://localhost:61626 ]]>
Or via Maven
<![CDATA[ maven server -Durl=tcp://localhost:61626 ]]>
Using the XML configuration
You can use the Xml Configuration to customize the Message Broker to suit your needs. You can run a broker from Maven as follows...
<![CDATA[ maven server -Dconfig=src/sample-conf/default.xml ]]>
If your classpath is setup correctly you can achieve the same thing from the command line
<![CDATA[ java org.activemq.spring.Main src/sample-conf/default.xml ]]>
Notice that we supply an alternative Main which is dependent on Spring and takes an XML configuration file as the argument.
Handling JMS brokers going down
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.
There is detailed documentation on this in Configuring Transports; briefly...
Just change your connection URI in 3.x to
<![CDATA[ reliable:tcp://host:port ]]>
Overview
Search
Sub Projects
Community
- Support
- Contributing
- Discussion Forums
- Mailing Lists
- IRC
- IRC Log
- Site
- Sponsorship
- Projects Using ActiveMQ
- Users
- Team
- Thanks
Features
- Advisory Message
- Clustering
- Cross Language Clients
- Enterprise Integration Patterns
- JMX
- JMS to JMS Bridge
- MasterSlave
- Message Groups
- Networks of Brokers
- Performance
- Persistence
- Security
- Virtual Destinations
- Visualisation
- More ...
Connectivity
- Ajax
- AMQP
- Axis and CXF Support
- C Integration
- C++
- C# and .Net Integration
- CMS
- J2EE
- JBoss Integration
- Jetty
- JNDI Support
- NMS
- REST
- RSS and Atom
- Spring Support
- Stomp
- Tomcat
- Unix Service
- WebLogic Integration
- XMPP
- More ...
Using ActiveMQ 5
- Getting Started
- Initial Configuration
- Running a Broker
- Embedded Brokers
- Command Line Tools
- Configuring Transports
- Examples
- Web Samples
- Monitoring the Broker
- Xml Configuration
- Xml Reference
- More ...
Using ActiveMQ 4
- Getting Started
- Initial Configuration
- Running a Broker
- Embedded Brokers
- Command Line Tools
- Configuring Transports
- Examples
- Web Samples
- Monitoring the Broker
- Xml Configuration
- Xml Reference
- More ...
Tools
External Tools
Support
Related Projects
Developers
Tests
- Maven2 Performance Plugin
- Benchmark Tests
- JMeter System Tests
- JMeter Performance Tests
- Integration Tests