This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Integrating Apache ActiveMQ with Glassfish
Skip to end of metadata
Go to start of metadata


See this article for a description of how to connect Glassfish 3 to an ActiveMQ 5 broker, and consume messages using a Message Driven Bean:

Glassfish 4.1


  1. Add resource adapter
    1. Download the resource-adapter file suitable to your broker version:
    2. Deploy the  resource adapter with the name "activemq-rar"

      bin/asadmin deploy --type rar --name activemq-rar /tmp/activemq-rar-5.11.1.rar
    3. Configure resource adapter
      (Failover Setup)

      bin/asadmin create-resource-adapter-config   \
        --property ServerUrl='failover\:(tcp\://broker-c1.foobar.local\:61616,tcp\://broker-c2.foobar.local\:61616,tcp\://broker-c3.foobar.local\:61616)?initialReconnectDelay\=2000&jms.useCompression\=true':UserName='admin':Password='admin' activemq-rar
  2.  Create connector connection pool

    bin/asadmin create-connector-connection-pool \
      --raname activemq-rar \
      --connectiondefinition javax.jms.ConnectionFactory \
      --ping true --isconnectvalidatereq true \
  3. Create a connector resource (JNDI-Mapping for connection pool)

    bin/asadmin create-connector-resource \
      --poolname jms/myConnectionPool \
  4. Configure JNDI mapping for a queue

    bin/asadmin create-admin-object \
    	  --raname activemq-rar \
      --restype javax.jms.Queue \
      --property PhysicalName=MY.MAGIC.OUT \
  5. Deploy your message driven beans and use the configured jndi names