Version 3

    This post provides details of how to integrate JBoss AS 7 with ActiveMQ as an external messaging broker without touching the standalone*.xml in JBoss AS mannually.

     

    This approach is derived from the one posted at http://blog.coffeebeans.at/?p=230. And similar but different post can be found at https://community.jboss.org/wiki/IntegrationOfJBossAS7WithActiveMQ.

     

    h2. Versions Used

    * JBoss AS 7.1.1 (or later, tested on JBoss EAP 6.0.1)

    * Apache ActiveMQ 5.6

     

    h2. Assumptions:

    # ActiveMQ 5.6 (or later) has been downloaded and installed as a *standalone*/*external* messaging broker.

    # JBoss AS 7.1.1 (or later) has been downloaded and installed.

     

    h2. Step-by-Step Guide

    # Download ActiveMQ 5.6 resource adapter from https://repository.apache.org/content/groups/public/org/apache/activemq/activemq-rar/5.6.0/activemq-rar-5.6.0.rar

    # Unpack activemq-rar-5.6.0.rar into a directory, refer as $AMQ_RAR_DIR hereafter

    # Update the properties according to your environment in $AMQ_RAR_DIR/META-INF/ra.xml

    # Update the following xml configuration (according to your ActiveMQ setup) and save it as $AMQ_RAR_DIR/META-INF/ironjacamar.xml{code:xml}

    <?xml version="1.0" encoding="UTF-8"?>

     

    <ironjacamar>

              <!-- This defines the ConnectionFactory bindings for JNDI -->

              <!-- The ConnectionFactory definitions specified here MUST be the Managed ones, and the ones specified in the ra.xml (if any) MUST be disabled, except the basic ConnectionFactory. -->

              <connection-definitions>

                        <connection-definition

                                            class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory"

                                            jndi-name="java:jboss/jms/demoCF" pool-name="QueueConnectionFactory">

                                  <pool>

                                            <min-pool-size>1</min-pool-size>

                                            <max-pool-size>200</max-pool-size>

                                            <prefill>false</prefill>

                                  </pool>

                                  <security>

                                            <application />

                                  </security>

                                  <timeout>

                                            <blocking-timeout-millis>30000</blocking-timeout-millis>

                                            <idle-timeout-minutes>3</idle-timeout-minutes>

                                  </timeout>

                                  <validation>

                                            <background-validation>false</background-validation>

                                            <use-fast-fail>false</use-fast-fail>

                                  </validation>

                        </connection-definition>

              </connection-definitions>

     

              <!-- Define your Topics/Queues here and specify a PhysicalName and a JNDI name -->

              <admin-objects>

                        <admin-object

                                            class-name="org.apache.activemq.command.ActiveMQQueue"

                                            jndi-name="java:jboss/jms/demoQueue">

                                  <config-property name="PhysicalName">jms/my-demoQueue</config-property>

                        </admin-object>

                        <admin-object

                                            class-name="org.apache.activemq.command.ActiveMQTopic"

                                            jndi-name="java:jboss/jms/demoTopic">

                                  <config-property name="PhysicalName">jms/my-demoTopic</config-property>

                        </admin-object>

              </admin-objects>

    </ironjacamar>{code}

    # Zip the content in $AMQ_RAR_DIR/ into file activemq-ra-5.6.0-DEMO.rar

    # Deploy the activemq-ra-5.6.0-DEMO.rar into JBoss AS as a normal deployment by using JBoss CLI or JBoss Management Console