Apache ActiveMQ is an open source (Apache 2.0 licensed) message broker which fully implements the Java Message Service 1.1 (JMS). It provides Enterprise Features like clustering, multiple message stores, and ability to use any database as a JMS persistence provider besides VM, cache, and journal persistency. In this tutorial we will show how to integrate the ActiveMQ message broker with JBoss AS 7
In order to run this tutorial we suggest you using the following server/library releases:
ActiveMQ Resource Adapter is not distributed anymore with the JMS broker bundle but you have to download it from Maven repository at http://repo1.maven.org/maven2/org/apache/activemq/activemq-rar/5.7.0/
Resource adapters (.rar) are deployed by copying the resource adapter into the deploy/ directory. Before doing that, we need to configure the Resource Adapter in your server configuration. This can be either done by adding the configuration in the jca subsystem, or (suggested choice) by creating an ironjacamar.xml which is a descriptor of the external resource.
The IronJacamar distribution features a resource adapter information tool (rar-info.sh), that can be used to create the resource adapter deployment descriptor, by generating a report file containing all the necessary information.
So start by issuing the following command:
This will generate a file called activemq-rar-5.7.0.txt which can be used to construct the ironjacamar.xml configuration file:
This file needs to be copied into the META-INF folder of the activemq-rar-5.7.0.rar.
Another thing I needed to customize is the ra.xml configuration file which contained an outbound resource adapter Connection definition not accepted by JBoss AS. Here's the correct ra.xml that you have to place in the META-INF folder of your resource adapter:
Now start JBoss AS 7 using the full configuration:
If everything is in the right place, you will see from the server logs that JCA Admin objects have been bound in JBoss' JNDI tree:
And here's a sample MDB which is able to consume JMS Messages from the ActiveMQ resource adapter:<