Apache TomEE is a distribution of Tomcat with fully integrated ActiveMQ offering full JMS support to plain war files, Servlets and more. No setup is required and code like the following will work out of the box.

All topics and queues are created automatically when declared properly in code as above. For example, the following reference in code:

Is identical to the following declaration in the <tomee.home>/conf/tomee.xml file or WEB-INF/resources.xml file:

In both situations Topic name would be 'foo'.

Configuring an Embedded Broker

If no broker is configured and JMS is used in the webapp, TomEE will create a broker equivalent to the following declaration:

This creates an ActiveMQ Broker that runs inside TomEE and is bound to the address someHostName:61616. This broker will start when TomEE starts and shutdown when TomEE shuts down. All JMS communication happening inside TomEE itself will happen using the embedded ActiveMQ Broker over the ActiveMQ "vm" transport which is optimized for sending and receiving messages when in the same JVM as the Broker.

Connecting to an External Broker

It is possible to connect to an ActiveMQ Broker running externally. The setup is similar to the above with only two changes.

Here the BrokerXmlConfig property is empty as we are not configuring an embedded broker to be run inside TomEE. The ServerUrl now points to an explicit remote host and port someHostName:61616 where an ActiveMQ Broker must be running. This Broker can be a plain ActiveMQ install or an ActiveMQ Broker embedded in a TomEE install.

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram