Using the ActiveMQ Resource Adapter, I recently integrated ActiveMQ with JBoss. The integration included both inbound and outbound messages. Inbound messages were handled by Message Driven Beans (MDBs) and outbound messages were published by an EJB Stateless Session Bean.
Since this turned out to be a non-trivial task, resulting in an absurd amount of hair loss for me, I figured I would share my new found knowledge with everyone else. Hopefully, someone else will find this useful.
You will need the following:
Apache ActiveMQ. We recommend 4.0.1 or later
The above diagram shows the message flows and the structure of the test. A small JMS client (not shown), sitting outside of JBoss, generates a JMS TextMessage and places it on either the queue.testQueue or the topic.testTopic. These inbound messages are consumed by one or more of the MDBs which then invoke the SenderEJB. The SenderEJB takes the input from the MDBs and publishes a simple response message to the queue.outbound queue.
Nothing fancy but it does demonstrate a wide set of possible configurations.
Components deployed to JBoss
In order to integrate ActiveMQ with JBoss (for this test), three files need to be placed into the JBoss deployment directory. They are:
-This is the ActiveMQ Connector (JCA). It contains a standard ra.xml deployment descriptor and does not require any JBoss specific files to be added to it. This file does not require any changes before deploying it, so you simply copy it 'as-is' into the JBoss deployment directory. It has no deployment time dependencies.
-This is a JBoss data source file. It contains configuration information that JBoss uses to create connector specific objects used for outbound communication. These objects are then made available through JNDI. (JBoss uses this same mechanism for configuring JDBC data sources.) This file contains specific entries that tie it to the activemq-ra-1.2.rar file, so it has a deployment time dependency on that file.
-This is a standard EJB archive deployed as a standalone module. It contains the standard ^ejb-jar.xml deployment descriptor plus an additional JBoss specific deployment descriptor. The JBoss specific file is named ^jboss.xml and is located in the /META-INF directory. The ^jboss.xml file contains all of the configuration information needed by JBoss to connect both the inbound and the outbound flows to ActiveMQ. It contains information that ties the ^ejb-jar.xml file it to both the ^panacya-jms-ds.xml file and the activemq-ra-1.2.rar file, so it has a deployment time dependency on both of those files.
You may need to to place the xbean-spring-<version> jar file to the server\defaul\deploy\lib directory
Here are some specific examples to help: