This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.
Close popover

Preventing stopped or delayed agents in JBoss EAR deployments with an ActiveMQ resource adapter

Agents in a Pega EAR deployment on the JBoss Enterprise Application Platform (EAP) application server stop or delayed after a period of time. When you add a slow agent, you eventually see multiple agents failing to meet their service level agreements (SLAs) compared to system clock time, as shown in the following example.

Agents scheduling run status, General Information

Agents scheduling run status, General Information

Agents scheduling run status, SendCorr times

Agents scheduling run status, SendCorr times

Agents scheduling run status, other agent times

Agents scheduling run status, other agent times

Analysis indicates that HornetQ, the embedded Java Message Service (JMS) in JBoss, is the root cause of this problem. Messages sent to HornetQ do not invoke the Pega Message-Driven Bean (MDB) onMessage() method in a timely way.

Debugging HornetQ was rejected in favor of installing the ActiveMQ resource adapter on JBoss and configuring the Pega MDB to use ActiveMQ in place of HornetQ.

You can choose to configure ActiveMQ to run in one of two ways:

  • As a standalone broker
  • As an embedded broker inside JBoss

This article explains how to install and configure the ActiveMQ resource adapter for JBoss Redhat EAP 6.1.

Install the ActiveMQ resource adapter

Configure the ActiveMQ resource adapter

Download and start the ActiveMQ broker (standalone broker only)

Install the ActiveMQ resource adapter

Installing the ActiveMQ resource adapter is not done in the standard way. Therefore, it is best to install it using the JBoss Administrator Console.

  1. From the Apache repository, https://repository.apache.org/content/repositories/releases/org/apache/activemq/activemq-rar/5.9.0/, download the ActiveMQ resource adapter, activemq-rar-5.9.0.rar.
  2. Inside the JBoss deployment, add this module: modules\system\layers\base\org\apache\activemq\main
  3. Extract the ActiveMQ resource adapter that you downloaded in Step1 to the folder \activemq\main.
    JBoss EAP 6.1 ActiveMQ main folder
    JBoss EAP 6.1 ActiveMQ main folder
  4. Open the file main\META-INF ra.xml and search for the comment <!-- NOTE disable the following property if you do not wish to deploy an embedded broker →
    • If you are configuring ActiveMQ as a standalone broker, remove the property.
    • If  you are configuring ActiveMQ as an embedded broker, keep the property.
  5. In the \activemq\main folder, create the file module.xml and specify it with the content shown after this screen:
    JBoss EAP 6.1 \activemq\main\module.xmlJBoss EAP 6.1 \activemq\main\module.xml

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

<module xmlns="urn:jboss:module:1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="org.apache.activemq">

   <resources>

      <resource-root path="." />

      <resource-root path="activemq-broker-5.9.0.jar" />

      <resource-root path="activemq-client-5.9.0.jar" />

      <resource-root path="activemq-jms-pool-5.9.0.jar" />

      <resource-root path="activemq-kahadb-store-5.9.0.jar" />

      <resource-root path="activemq-openwire-legacy-5.9.0.jar" />

      <resource-root path="activemq-pool-5.9.0.jar" />

      <resource-root path="activemq-protobuf-1.1.jar" />

      <resource-root path="activemq-ra-5.9.0.jar" />

      <resource-root path="activemq-spring-5.9.0.jar" />

      <resource-root path="aopalliance-1.0.jar" />

      <resource-root path="commons-pool-1.6.jar" />

      <resource-root path="commons-logging-1.1.3.jar" />

      <resource-root path="hawtbuf-1.9.jar" />

      <resource-root path="spring-aop-3.2.4.RELEASE.jar" />

      <resource-root path="spring-beans-3.2.4.RELEASE.jar" />

      <resource-root path="spring-context-3.2.4.RELEASE.jar" />

      <resource-root path="spring-core-3.2.4.RELEASE.jar" />

      <resource-root path="spring-expression-3.2.4.RELEASE.jar" />

      <resource-root path="xbean-spring-3.14.jar" />

   </resources>

   <exports>

      <exclude path="org/springframework/**" />

      <exclude path="org/apache/xbean/**" />

      <exclude path="org/apache/commons/**" />

      <exclude path="org/aopalliance/**" />

      <exclude path="org/fusesource/**" />

   </exports>

   <dependencies>

      <module name="javax.api" />

      <module name="org.slf4j" />

      <module name="javax.resource.api" />

      <module name="javax.jms.api" />

      <module name="javax.management.j2ee.api" />

   </dependencies>

</module>

Configure the ActiveMQ resource adapter

Modify the file Standalone-full.xml

Standalone broker

Embedded broker

Ensure that the MDBs use the ActiveMQ resource adapter

Modify the prpc_j2ee14_jboss61JBM preconfigured JMS topic

Modify the file Standalone-full.xml

Update the resource adapter subsystem in the Standalone-full.xml configuration file by adding the following parameters in the resource-adapter subsystem, depending on whether you are configuring Active MQ as a standalone broker or embedded broker.

Standalone broker

For a standalone broker, specify the ServerURL as tcp://localhost:61616.

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> 

            <resource-adapters> 

                <resource-adapter id="org.apache.activemq.ra"> 

                    <module slot="main" id="org.apache.activemq"/> 

                    <transaction-support>NoTransaction</transaction-support> 

                    <config-property name="ServerUrl"> 

                        tcp://localhost:61616 

                    </config-property> 

                    <connection-definitions> 

                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/jms/PRAsyncTCF" enabled="true" pool-name="ActiveMQConnectionFactoryPool"> 

                        </connection-definition> 

                    </connection-definitions> 

                    <admin-objects> 

                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/jms/PRAsyncTopic" use-java-context="true" pool-name="PRAsyncTopic"> 

                            <config-property name="PhysicalName"> 

                                java:/topic/jms/PRAsyncTopic 

                            </config-property> 

                        </admin-object> 

                    </admin-objects> 

                </resource-adapter> 

            </resource-adapters> 

        </subsystem>

Embedded broker

For an embedded broker, specify the ServerURL as vm://localhost.

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> 

            <resource-adapters> 

                <resource-adapter id="org.apache.activemq.ra"> 

                    <module slot="main" id="org.apache.activemq"/> 

                    <transaction-support>NoTransaction</transaction-support> 

                    <config-property name="ServerUrl"> 

                        vm://localhost 

                    </config-property> 

                    <connection-definitions> 

                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/jms/PRAsyncTCF" enabled="true" pool-name="ActiveMQConnectionFactoryPool"> 

                        </connection-definition> 

                    </connection-definitions> 

                    <admin-objects> 

                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/jms/PRAsyncTopic" use-java-context="true" pool-name="PRAsyncTopic"> 

                            <config-property name="PhysicalName"> 

                                java:/topic/jms/PRAsyncTopic 

                            </config-property> 

                        </admin-object> 

                    </admin-objects> 

                </resource-adapter> 

            </resource-adapters> 

        </subsystem>  

Ensure that the MDBs use the ActiveMQ resource adapter

Locate the tag <mdb> and update it as shown here:

<mdb> 

                <resource-adapter-ref resource-adapter-name="org.apache.activemq.ra"/> 

                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> 

</mdb>  

Modify the prpc_j2ee14_jboss61JBM preconfigured JMS topic

Open the file prpc_j2ee14_jboss61JBM\META-INF\hornetq-jms.xml and comment out or remove the <hornetq-server> tags as shown here:

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

<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0"> 

   <!— (remove the hornetq-server tags and everything enclosed by them)

<hornetq-server> 

      <jms-destinations> 

                      <jms-topic name="PegaAsyncTopic"> 

                        <entry name="topic/jms/PRAsyncTopic"/> 

                    </jms-topic> 

                </jms-destinations> 

    </hornetq-server> 

          -- >

</messaging-deployment>

Download and start the ActiveMQ broker (standalone broker only)

If you are configuring the ActiveMQ broker as an embedded broker, skip this section. You can start ActiveMQ and deploy the modified Pega 7 EAR file.

If you are configuring the ActiveMQ broker as a standalone broker, complete the following steps:

  1. Download the ActiveMQ broker: http://activemq.apache.org/activemq-590-release.html
  2. Start it with the default port. File folder apache_activemq_590_binFile folder apache_activemq_590_bin
  3. Log in as Administrator and create a topic with the same name as the physical name that you specified in the resource adapter subsystem, Configure the ActiveMQ resource adapter, Modify the file Standalone-full.xml. ActiveMQ topic PRAsynchTopic ActiveMQ topic PRAsynchTopic
  4. You are all set! Start ActiveMQ and deploy the modified Pega 7 EAR file.

 


100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.