Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to integrate A-MQ 6.3 on Red Hat JBoss EAP 7

August 20, 2018
Abraham Francisco Arellano Tavara
Related products:
Streams for Apache KafkaRed Hat JBoss Enterprise Application Platform

Share:

    This article describes in detail how to integrate Red Hat A-MQ 6.3 on Red Hat JBoss Enterprise Application Platform (EAP) 7 and covers in detail the admin-object configuration, especially the pool-name configuration. The attribute pool-name for the admin-object explanation can lead to confusion. In this post, I will try to clarify many of the steps, give an overview of the components, and how they fit together.

    The JBoss EAP requires the configuration of a resource adapter as a central component for integration with the A-MQ 6.3. In addition, the MDBs configuration on the EAP is required to enable the JMS consumers. On the A-MQ 6.3, the configuration of the Transport Connectors is required to open the communication channel with the EAP.

    All the steps required to configure EAP 7 to use A-MQ 6.3 as an external JMS broker are described here:

    • Generic Resource Adapter configuration on JBoss EAP 7
    • MDB configuration for EJB subsystem
    • A-MQ ports/transport-connectors/security configuration

    Overview of JBoss EAP and A-MQ components

    First, is important to understand the components involved in the configuration and the relationship between them.

    Resource Adapter

    The resource adapter is the central component for the JBoss EAP configuration. It provides the link from the EAP to the A-MQ broker.

    In a nutshell, a resource adapter is a deployable Java EE component (usually a .rar file). The resource adapter provides communication between a Java EE application (usually deployed on the JBoss EAP instance) and an Enterprise Information System (EIS) using the Java Connector Architecture (JCA) specification.

    A resource adapter is often provided by EIS vendors to allow easy integration of their products with Java EE applications.

    On JBoss EAP 7, the resource adapters are defined in the resource-adapter subsystem.

    MDB

    The MDB configuration in JBoss EAP provides the capability to the Java applications to create a consumer of the A-MQ linked to JBoss EAP. In addition, the MDB pool provides a constraint on the number of instances and sessions available.

    Transport Connectors

    The Transport Connectors are endpoints defined on the A-MQ broker that allows client-broker communication. The Transport Connectors can be configured using different Transport Protocols (TCP, SSL, HTTP, HTTPS, etc.) and can support different Wire Protocols (Openwire, STOMP, AMQP, etc.)

    Components integration overview

    The image below depicts in a simple way how the components described above are related.

    Generic Resource Adapter configuration on EAP 7

    In JBoss EAP 7.1, the recommended messaging broker is AMQ 7, which has an integrated resource adapter in the messaging subsystem. However, is possible to use a different messaging broker or a legacy A-MQ messaging broker.

    Extract the resource adapter from the A-MQ 6.3 distribution.

    The initial step is to extract the .rar file from the A-MQ 6.3 distribution to a more accessible location. The resource adapter zip container is located in $AMQ_HOME/extras/apache-activemq-5.11.0.redhat-[LATEST_VERSION]-bin.zip.

    unzip $AMQ_HOME/extras/apache-activemq-5.11.0.redhat-[LATEST_VERSION]-bin.zip \
    -d /tmp
    

    Extract the file to a known location: [AMQ_RAR_DIRECTORY].

    Deploy the resource adapter in a standalone/domain JBoss server using the CLI.

    Server$ jboss-cli.sh

    In a standalone server:

    Server$ deploy /tmp/apache-activemq-5.11.0.redhat-[LATEST_VERSION]/lib/optional\
    /activemq-rar-5.11.0.redhat-[LATEST_VERSION].rar
    

    In a domain managed server:

    Server$ deploy /tmp/apache-activemq-5.11.0.redhat-[LATEST_VERSION]/lib/optional\
    /activemq-rar-5.11.0.redhat-[LATEST_VERSION].rar \
    –server-groups=[SERVER_GROUP_1],[SERVER_GROUP_2],...
    

    Deploy the resource adapter using the management console.

    Is also possible to deploy the resource adapter using the management console

    Manual resource adapter deployment in a standalone server using the deployment scanner:

    In order to deploy a resource adapter manually to a standalone server, copy the resource adapter archive to the server deployments directory $EAP_HOME/standalone/deployments/. As a result, the scanner will inspect the deployments directory and deploy the resource adapter.

    New profiles for domain managed server:
    Probably, it is a requirement to have different server groups working with different broker technology or configuration. In order to achieve a better separation of concerns regarding access to JMS services, a new profile that contains the broker configuration can be created.

    Resource adapter manual configuration

    Add a resource adapter element to the resource-adapters subsystem:

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Definition of the archive of the resource adapter:

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
          <archive>
            activemq-rar.rar
          </archive>
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Set up different configuration properties:
    First, set up the server URL, the access credentials, and the type of transaction support.

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
          <archive>
            activemq-rar.rar
          </archive>
          <transaction-support>XATransaction</transaction-support>
          <config-property name="ServerUrl">
            tcp://[BROKER_HOST]:[BROKER_PORT]
          </config-property>
          <config-property name="UserName">
            myusername
          </config-property>
          <config-property name="Password">
            mypassword
          </config-property>
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Establish connection definitions:
    A possible connection-definition class-name can be: org.apache.activemq.ra.ActiveMQManagedConnectionFactory. The election depends on the type of factory you have to use.

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
          <archive>
            activemq-rar.rar
          </archive>
          <transaction-support>XATransaction</transaction-support>
          <config-property name="ServerUrl">
            tcp://[BROKER_HOST]:[BROKER_PORT]
          </config-property>
          <config-property name="UserName">
            myusername
          </config-property>
          <config-property name="Password">
            mypassword
          </config-property>
          <connection-definitions>
            <connection-definition class-name="com.ra.EISManagedConnectionFactory" 
                 jndi-name="java:/jms/connection/amq/ManagedConnectionFactory" 
                 enabled="true" 
                 pool-name="A-MQ">
              <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
                <prefill>false</prefill>
                <is-same-rm-override>false</is-same-rm-override>
              </xa-pool>
              <validation>
                <use-fast-fail>false</use-fast-fail>
              </validation>
            </connection-definition>
          </connection-definitions>      
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Configure XA Recovery plugin:
    The "XA recovery" is the process that updates or rollback a transaction if one of the participant crash or is unavailable. XA recovery happens without user intervention.

    Each XA resource needs to have a recovery module associated with its configuration.

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
          <archive>
            activemq-rar.rar
          </archive>
          <transaction-support>XATransaction</transaction-support>
          <config-property name="ServerUrl">
            tcp://[BROKER_HOST]:[BROKER_PORT]
          </config-property>
          <config-property name="UserName">
            myusername
          </config-property>
          <config-property name="Password">
            mypassword
          </config-property>
          <connection-definitions>
            <connection-definition class-name="com.ra.EISManagedConnectionFactory" 
                 jndi-name="java:/jms/connection/amq/ManagedConnectionFactory" 
                 enabled="true" 
                 pool-name="A-MQ">
              <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
                <prefill>false</prefill>
                <is-same-rm-override>false</is-same-rm-override>
              </xa-pool>
              <validation>
                <use-fast-fail>false</use-fast-fail>
              </validation>
              <recovery>
                <recover-credential>
                  <user-name>recoveryuser</user-name>
                  <password>recoverypassword</password>
                </recover-credential>
                <recover-plugin 
                   class-name="org.jboss.jca.core.recovery.ConfigurableRecoveryPlugin">
                  <config-property name="enableIsValid">
                    false
                  </config-property>
                  <config-property name="isValidOverride">
                    true
                  </config-property>
                </recover-plugin>
              </recovery>
            </connection-definition>
          </connection-definitions>      
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Admin objects setup and configuration:

    The admin objects are created in order to provide JNDI lookup of JMS queues for JBoss EAP applications.

    The attribute that often causes problems to define an unanswered question is the pool-name attribute of the admin-object. The attribute "pool-name is not implemented in JBoss EAP, that means, this attribute should not be used.

    <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0">
      <resource-adapters>
        <resource-adapter id="activemq-rar.rar" statistics-enabled="true">
          <archive>
            activemq-rar.rar
          </archive>
          <transaction-support>XATransaction</transaction-support>
          <config-property name="ServerUrl">
            tcp://[BROKER_HOST]:[BROKER_PORT]
          </config-property>
          <config-property name="UserName">
            myusername
          </config-property>
          <config-property name="Password">
            mypassword
          </config-property>
          <connection-definitions>
            <connection-definition class-name="com.ra.EISManagedConnectionFactory" 
                 jndi-name="java:/jms/connection/amq/ManagedConnectionFactory" 
                 enabled="true" 
                 pool-name="A-MQ">
              <xa-pool>
                <min-pool-size>1</min-pool-size>
                <max-pool-size>50</max-pool-size>
                <prefill>false</prefill>
                <is-same-rm-override>false</is-same-rm-override>
              </xa-pool>
              <validation>
                <use-fast-fail>false</use-fast-fail>
              </validation>
              <recovery>
                <recover-credential>
                  <user-name>recoveryuser</user-name>
                  <password>recoverypassword</password>
                </recover-credential>
                <recover-plugin 
                  class-name="org.jboss.jca.core.recovery.ConfigurableRecoveryPlugin">
                  <config-property name="enableIsValid">
                    false
                  </config-property>
                  <config-property name="isValidOverride">
                    true
                  </config-property>
                </recover-plugin>
              </recovery>
            </connection-definition>
          </connection-definitions>      
          <admin-objects>
            <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" 
                 jndi-name="java:/jms/myapp/myqueuename" 
                 pool-name="MY_POOL_NAME">
              <config-property name="PhysicalName">
                myapp_mycontext_myqueuename
              </config-property>
            </admin-object>
          </admin-objects>      
        </resource-adapter>
      </resource-adapters>
    </subsystem>
    

    Resource adapter CLI configuration

    You can configure resource adapters using the management interfaces. I show below how to configure a resource adapter using the management CLI. If you are using this document as a reference for other resource adapters, it is important to check the vendor’s documentation for supported properties and other important information.

    Add a resource adapter element to the resource-adapters subsystem and define the archive of the resource adapter:

    /subsystem=resource-adapters/resource-adapter=eis.rar:add(archive=eis.rar, \
    transaction-support=XATransaction)
    

    Define different configuration properties:

    Add the server configuration property.

    /subsystem=resource-adapters/resource-adapter=activemq-rar.rar/\
    config-properties=server:add(value=[$AMQ_BROKER_URL])
    

    Add the port configuration property.

    /subsystem=resource-adapters/resource-adapter=activemq-rar.rar/\
    config-properties=port:add(value=[$AMQ_BROKER_PORT])
    

    Define connection definitions:

    Add a connection definition for a managed connection factory.

    /subsystem=resource-adapters/resource-adapter=eis.rar/\
    connection-definitions=cfName:add(class-name=com.ra.EISManagedConnectionFactory, \
    jndi-name=java:/jms/connection/amq/ManagedConnectionFactory)
    

    Configure a managed connection factory configuration property.

    /subsystem=resource-adapters/resource-adapter=eis.rar/connection-definitions=cfName/\
    config-properties=name:add(value=Acme Inc)
    

    Configure XA Recovery plugin:

    In order to correctly define the "recovery-plugin-properties" using the CLI commands, first, add "recovery-plugin-class-name".

    /subsystem=datasources/xa-data-source=test-xa-datasource/\
    :write-attribute(name=recovery-plugin-class-name,\
    value=org.jboss.jca.core.recovery.ConfigurableRecoveryPlugin)
    

    Then add the "recovery-plugin-properties".

    /subsystem=datasources/xa-data-source=test-xa-datasource/\
    :write-attribute(name=recovery-plugin-properties,\
    value={"EnableIsValid" => "false",\
    "IsValidOverride" => "true",\
    "EnableClose" => "false"})
    

    Admin objects setup and configuration:

    Add an admin object.

    /subsystem=resource-adapters/resource-adapter=activemq-rar.rar/\
    admin-objects=aoName:add(\
    class-name=org.apache.activemq.command.ActiveMQQueue, \
    jndi-name=java:/jms/myapp/myqueuename)
    

    Configure an admin object configuration property.

    /subsystem=resource-adapters/resource-adapter=activemq-rar.rar/\
    admin-objects=aoName/config-properties=threshold:add(value=10)
    

    Activate the Resource Adapter:

    Activate the resource adapter.

    /subsystem=resource-adapters/resource-adapter=activemq-rar.rar:activate	
    

    MDB configuration for EJB subsystem

    First is important to understand what an MDB is. MDBs are a special kind of stateless session beans and they are the JMS consumer of a specific queue.

    They implement a method called onMessage(Message message) executed when a JMS destination on which the MDB is listening receives a message.

    The JMS consumer is responsible to trigger a MDBs asynchronously.

    By default, the MDBs have 16 sessions to process messages concurrently.

    Add the requisite message-driven bean configuration to the urn:jboss:domain:ejb3 subsystem in the JBoss EAP configuration.

    <mdb>
      <resource-adapter-ref resource-adapter-name="activemq-rar.rar"/>
      <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
    </mdb>
    

    In addition, define the MDB pool:

    <pools>
    	<bean-instance-pools>
    		<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" 
                 instance-acquisition-timeout="5" 
                 instance-acquisition-timeout-unit="MINUTES"/>
    		<strict-max-pool name="mdb-strict-max-pool" 
    		     max-pool-size="20" 
                 instance-acquisition-timeout="5" 
                 instance-acquisition-timeout-unit="MINUTES"/>
    	</bean-instance-pools>
    </pools>
    

    The final standalone.xml configuration should look like:

    <server ...>
        ...
        <profile>
            ...
            <subsystem xmlns="urn:jboss:domain:ejb3:...">
                ...
                <mdb>
                    <resource-adapter-ref resource-adapter-name="activemq-rar.rar"/>
                    <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
                </mdb>
                <pools>
                    <bean-instance-pools>
                        <strict-max-pool name="slsb-strict-max-pool" 
                             max-pool-size="20" 
                             instance-acquisition-timeout="5" 
                             instance-acquisition-timeout-unit="MINUTES"/>
                        <strict-max-pool name="mdb-strict-max-pool" 
                             max-pool-size="20" 
                             instance-acquisition-timeout="5" 
                             instance-acquisition-timeout-unit="MINUTES"/>
                    </bean-instance-pools>
                </pools>
                ...
            </subsystem>
            ...
        </profile>
        ...
    </server>
    

    A-MQ ports/transport-connectors

    First, the A-MQ configuration requires the transport connectors that define the endpoint used by JBoss EAP to integrate the resource adapter.

    Implement the following configuration in the activemq.xml:

    <transportConnectors>
       <transportConnector name="openwire-client" 
            uri="nio://0.0.0.0:[BROKER_PORT]?[TRANSPORT_OPTIONS]"/>
    </transportConnectors>
    

    Summary

    This article provides a detailed description of Red Hat JBoss EAP 7 integration with A-MQ 6.3 and the admin-object configuration, which is a complex process if the required steps are not clear for the integrator. This article covers the admin-object setup and the pool-name attribute in great detail and provides a good hint regarding the correct configuration.

    Last updated: September 3, 2019

    Recent Posts

    • Create and enrich ServiceNow ITSM tickets with Ansible Automation Platform

    • Expand Model-as-a-Service for secure enterprise AI

    • OpenShift LACP bonding performance expectations

    • Build container images in CI/CD with Tekton and Buildpacks

    • How to deploy OpenShift AI & Service Mesh 3 on one cluster

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue