Support Article

Unable to configure custom JMS MDB listener in JBoss EAP 6.x

SA-39455

Summary



Unable to configure a custom JMS MDB listener to receive messages from a remote HornetQ queue with name MY.CUSTOM.QUEUE in JBoss EAP 6.x

Error Messages



2017-05-19 13:32:10,939 INFO [org.jboss.as.ejb3] (service thread 1-15) JBAS014142: Started message driven bean 'MyCustomeMDBListener' with 'hornetq-ra' resource adapter
2017-05-19 13:32:11,083 INFO [org.hornetq.ra] (default-threads - 2) HQ151000: awaiting topic/queue creation java:jboss/jms/queue/MY.CUSTOM.QUEUE
2017-05-19 13:32:13,084 INFO [org.hornetq.ra] (default-threads - 2) HQ151001: Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@1f38386c destination=java:jboss/jms/queue/MY.CUSTOM.QUEUEdestinationType=javax.jms.Queueack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)


Steps to Reproduce

  1. Configure the JMS MDB listener on JBoss EAP 6.x.
  2. After the deployment descriptors in the Pega 7 application’s prbeans.jar file are updated, redeploy and restart your Pega 7 application.
  3. Observe that messages in the remote queue are not being consumed


Root Cause



An environment configuration issue:
The MDB was unable to lookup the remote destination as, by being remote, it was not included in the local JNDI tree.
Issue is caused by lack of configuration details to properly identify the remote destination.
This is because a brand new MDB Listener, when configured in PRPC, expects just a destinationTypeand the destination property.
E.g
.:

This, in case of a JBoss server, leads to the creation of the following changes to deployment descriptors:
  • in ejb-jar.xml:

  • in jboss-ejb3.xml:
In the snippets above the destination is identified by mean of a JNDI name. It’s up to the EJB Container to provide an instance of this JNDI entry.
This is a configuration task usually performed at deployment time by the application server that maps a physical resource to a
JNDI entry.
Each application server has its own ways to accomplish this task.

In JBoss EAP 6.x this task can be accomplished in different ways:
  • Provide extra activation-config-property entries in ejb-jar.xml for the custom MDB.
  • Define a remote netty-connector managed by the JEE container in the standalone(-full),xml configuration file then provide a resource-adapter-binding in the jboss-ejb3.xml to point to the name of the pooled-connection-factory resource
  • Define a JMS bridge in the message consumer to map remote destination to an existing local one then point the MDB to listen to the local destination
Which one to choose depends from the specific usage context.

Resolution



Given a remote HornetQ queue is in use in this case make the following change to the ejb-jar.xml deployment descriptor:Add the following activation config properties to the activation-config element of the message-driven stanza for the custom MDB replacing <REMOTE_HOSTNAME> and <REMOTE_PORT> placeholders with the actual values of the remote HornetQ server:
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>queue/MY.CUSTOM.QUEUE</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectorClassName</activation-config-property-name>
<activation-config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>connectionParameters</activation-config-property-name>
<activation-config-property-value>host=<REMOTE_HOSTNAME>;port=<REMOTE_PORT></activation-config-property-value>
</activation-config-property>

Published June 15, 2017 - Updated June 16, 2017

Have a question? Get answers now.

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