Integrating RabbitMQ with Pega Platform 8.8.1

Hi,

We have a requirement to integrate RabbitMQ with PegaPlatform

I followed all the steps mentioned in the below Post but its not working

The main issue here us that in JMSProperties tab in JMSListenerForm, there are no values coming in the dropdown for pyConnectionFactory and pyResourceName fields.

I have added the below resources in Context.xml in …\tomcat\conf\context.xml

Also placed the following jar files in ..\tomcat\lib

RabbitMQ AMQP Client: https://mvnrepository.com/artifact/com.rabbitmq/amqp-client/5.7.0
RabbitMQ JMS Client: https://search.maven.org/artifact/com.rabbitmq.jms/rabbitmq-jms/1.11.2/jar
Sun Filesystem Context: https://mvnrepository.com/artifact/com.sun.messaging.mq/fscontext/4.6-b01
Geronimo JMS Specs: https://mvnrepository.com/artifact/org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1

Also tried this solution

It will be great if I can get some help on this.

@cdundu I can see that support ticket INC-B16911 has been resolved 13th June with the following closure note:


Explanation description:

During resolution of the case we meet couple of problems which was solved step by step:

  1. Customer follow old documentation below
    https://support.pega.com/question/does-pega-support-integration-rabbit-mq
    but after configuring the JMS Listener with relevant JMS Properties and when I tried to do a test connectivity. I am getting the following Error:

Status: Fail

Message: Couldn’t resolve JMS connection factory object ‘java:comp/env/jms/ConnectionFactory’ from JNDI server at , javax.naming.NameNotFoundException: Name [ConnectionFactory] is not bound in this Context. Unable to find [ConnectionFactory].

Moreover client created a JMS listener with following “JMS Properties”
Note: There was no dropdown populated in ContextFatory and Resource name. They had to added them manually


When You configure the JMS listener, if all of the prior steps have been completed, the list of installed JNDI resources should appear automatically, if You hit the down arrow button in the pyConnectionFactory text box.
so it looks like there is some misconfiguration if You need to add them manually.

  1. Customer need to check context.xml, if is having resource <Resource name="jms/ConnectionFactoy../>
    Can You try use
    name=“jms/ConnectionFactory”
    instead of
    name=“jms/MyCFQ”

  2. It lookd like there is some Java version incapability with imported jar files which are mentioned in old article:
    https://support.pega.com/question/does-pega-support-integration-rabbit-mq

We need to add below jars into tomcat’s lib when JRE version 1.8 is using:

jakarta.jms-api-2.0.2.jar
rabbitmq-jms-1.11.0.jar
amqp-client-5.21.0.jar
slf4j-api-2.0.12.jar

  1. After jars import from point 4), dropdowns values should start appeared for ContextFatory and Resource name

  1. then we can see, that test connection is progressing but “create connection” is still failed

in the logs we can see:

2024-06-12 12:31:06,796 [ JMS-Thread-62] ( services.jms.JMSListener) ERROR JMS.testJMS - Caught JMSException in listener testJMS

com.rabbitmq.jms.util.RMQJMSException: null

at com.rabbitmq.jms.admin.RMQConnectionFactory.instantiateNodeConnection(RMQConnectionFactory.java:341) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory.createConnection(RMQConnectionFactory.java:284) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory.createConnection(RMQConnectionFactory.java:233) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

at com.pega.pegarules.integration.engine.internal.services.jms.JMSListener.initializeConnection(JMSListener.java:1074) ~[printegrint.jar:?]

at com.pega.pegarules.integration.engine.internal.services.jms.JMSListener.runPoller(JMSListener.java:756) ~[printegrint.jar:?]

at com.pega.pegarules.integration.engine.internal.services.jms.JMSListener.run_(JMSListener.java:751) ~[printegrint.jar:?]

at com.pega.pegarules.integration.engine.internal.services.listener.ServiceListenerBaseImpl.run(ServiceListenerBaseImpl.java:476) ~[printegrint.jar:?]

at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_202]

Caused by: java.io.IOException

at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:140) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:136) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:158) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:454) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:71) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:165) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1242) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1198) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1156) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1321) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory$4.create(RMQConnectionFactory.java:237) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory.instantiateNodeConnection(RMQConnectionFactory.java:328) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

… 7 more

Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - vhost Notification not found, class-id=10, method-id=40)

at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:552) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:316) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:152) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:454) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:71) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:165) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1242) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1198) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1156) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1321) ~[amqp-client-5.21.0.jar:5.21.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory$4.create(RMQConnectionFactory.java:237) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

at com.rabbitmq.jms.admin.RMQConnectionFactory.instantiateNodeConnection(RMQConnectionFactory.java:328) ~[rabbitmq-jms-1.11.0.jar:1.11.0]

… 7 more

Try use in Context.xml file: virtualHost=“/” instead of virtualHost=“Notification”
If You are using some other name for Virtual host at Rabbit MQ menager, please use that.
Default virtualHost is “/”

  1. then test JMS connectivity works

  1. But customer got problem with read the messages posted in the Queue from RabbitMQ console.

customer is using below configuration for Service JMS → Request tab

and try to send message from Rabbit MQ console:

But, JMS listener failed with reading that message with errors il logs:

ERROR JMS.testJMS - Caught exception while processing request for service LOLAServices.testJMS.TestJMSService, com.pega.pegarules.pub.PRException: Expecting a TextMessage, received a message of type: com.rabbitmq.jms.client.message.RMQBytesMessage

2024-06-12 16:25:33,001 [ JMS-Thread-90] [ ] [ ] [ ] ( services.jms.JMSListener) ERROR JMS.testJMS - Caught exception while processing request for service LOLAServices.testJMS.TestJMSService, javax.jms.MessageFormatException: Not enough bytes in message body for UTF object


In service JMS we need to use appropriate MessageFormat, accoriding to documentation below:
https://docs.pega.com/bundle/platform-88/page/platform/data-integration/service-jms-request-tab.html

Moreover, according to RabbitMQ documentation below:

https://rabbitmq.github.io/rabbitmq-jms-client/2.x/stable/htmlsingle/index.html

customer need to use JMSType to “TextMessage” at header, during sending message from Rabbit MQ console.

and use Text Message in request type and Data type as STRING in Message data

  1. finally we can see that JMS listener is working and processing message without failure.
    We can see pyNote with expected test in tracer for working listener.


I have marked this as the accepted answer in order to help our other forum users if they encounter similar issues working with RabbitMQ.

Please use the above information as well as information already available in the solution of the available question :
https://support.pega.com/question/integration-rabbitmq