Overview
RabbitMQ provides a native JMS client library, which can be used for JMS over AMQP with Integration Server.
https://www.rabbitmq.com/jms-client.html
See the following article for RabbitMQ setup and configuration.
As of today, the native client support AMQP 0-9-1.
To validate the AMQP protocol version, go to RabbitMQ admin console>Connections , check Protocol .
To validate the virtual host connection points, go to RabbitMQ admin console > Connections , check Virtual host.
Ensure that the RabbitMQ node is enabled with the rabbitmq-jms-topic-exchange plugin.
Note: If the JMS trigger in webMethods Integration Server fails with the “JMS Trigger <Trigger_Name> failed preprocessing: java.lang.NumberFormatException: Null is not a valid int” exception, provide a JMS message priority value while sending the JMS message.
Note: In some versions, if “Message TTL” is configured on the RabbitMQ queue, the trigger in Integration Server receives the messages from that queue only if the queue in RabbitMQ is bound to the “amq.direct” exchange.
JNDI binding
Define JNDI bindings
Create a binding file for RabbitMQ
Define the connection URI
The format would be something like
amqp://[user]:[password]@[host]:[post]/ (for default virtual host)
amqp://[user]:[password]@[host]:[post]/[virtual host name] (for specific virtual host)
So we need to define a vhost section and a uri section for this
#uri (with default vhost, no vhost definition required)
ConnectionFactory/RefAddr/9/Content=amqp://guest:guest@localhost:5672/
ConnectionFactory/RefAddr/9/Type=uri
ConnectionFactory/RefAddr/9/Encoding=String
#uri (with vhost democonnect)
ConnectionFactory/RefAddr/9/Content=amqp://guest:guest@localhost:5672/democonnect
ConnectionFactory/RefAddr/9/Type=uri
ConnectionFactory/RefAddr/9/Encoding=String
#vhost (democonnect)
ConnectionFactory/RefAddr/4/Content=democonnect
ConnectionFactory/RefAddr/4/Type=vhost
ConnectionFactory/RefAddr/4/Encoding=String
Define Connection Factory Object
#Connection Factory Object (lookup name ConnectionFactory)
ConnectionFactory/ClassName=javax.jms.ConnectionFactory
ConnectionFactory/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory
ConnectionFactory/RefAddr/0/Content=jms/ConnectionFactory
ConnectionFactory/RefAddr/0/Type=name
ConnectionFactory/RefAddr/0/Encoding=String
ConnectionFactory/RefAddr/1/Content=javax.jms.ConnectionFactory
ConnectionFactory/RefAddr/1/Type=type
ConnectionFactory/RefAddr/1/Encoding=String
ConnectionFactory/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory
ConnectionFactory/RefAddr/2/Type=factory
ConnectionFactory/RefAddr/2/Encoding=String
Define destination (Queue lookup name testQueue1)
# testQueue1 Queue
testQueue1/ClassName=javax.jms.Queue
testQueue1/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory
testQueue1/RefAddr/0/Content=jms/Queue
testQueue1/RefAddr/0/Type=name
testQueue1/RefAddr/0/Encoding=String
testQueue1/RefAddr/1/Content=javax.jms.Queue
testQueue1/RefAddr/1/Type=type
testQueue1/RefAddr/1/Encoding=String
testQueue1/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory
testQueue1/RefAddr/2/Type=factory
testQueue1/RefAddr/2/Encoding=String
testQueue1/RefAddr/3/Content=testQueue1
testQueue1/RefAddr/3/Type=destinationName
testQueue1/RefAddr/3/Encoding=String
testQueue1/RefAddr/4/Content=true
testQueue1/RefAddr/4/Type=amqp
testQueue1/RefAddr/4/Encoding=String
testQueue1/RefAddr/5/Content=testqueue1exchange
testQueue1/RefAddr/5/Type=amqpExchangeName
testQueue1/RefAddr/5/Encoding=String
testQueue1/RefAddr/6/Content=testQueue1
testQueue1/RefAddr/6/Type=amqpRoutingKey
testQueue1/RefAddr/6/Encoding=String
testQueue1/RefAddr/7/Content=testQueue1
testQueue1/RefAddr/7/Type=amqpQueueName
testQueue1/RefAddr/7/Encoding=String
Define host/port (host: localhost, port: 5672)
#Host
ConnectionFactory/RefAddr/3/Content=localhost
ConnectionFactory/RefAddr/3/Type=host
ConnectionFactory/RefAddr/3/Encoding=String
#Port
ConnectionFactory/RefAddr/7/Content=5672
ConnectionFactory/RefAddr/7/Type=port
ConnectionFactory/RefAddr/7/Encoding=String
Define Credentials (username/password)
#Username (guest)
ConnectionFactory/RefAddr/5/Content=guest
ConnectionFactory/RefAddr/5/Type=username
ConnectionFactory/RefAddr/5/Encoding=String
#Password (guest)
ConnectionFactory/RefAddr/6/Content=guest
ConnectionFactory/RefAddr/6/Type=password
ConnectionFactory/RefAddr/6/Encoding=String
Note: If you use a virtual host, create an exchange in that virtual host and bind it to the queue. In the JNDI bindings example, “testqueue1exchange” is the exchange created on “democonnect”. “testQueue1” is the queue bound to “testqueue1exchange”.
Sample .bindings file content
.bindings
#Connection Factory Object
ConnectionFactory/ClassName=javax.jms.ConnectionFactory
ConnectionFactory/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory
ConnectionFactory/RefAddr/0/Content=jms/ConnectionFactory
ConnectionFactory/RefAddr/0/Type=name
ConnectionFactory/RefAddr/0/Encoding=String
ConnectionFactory/RefAddr/1/Content=javax.jms.ConnectionFactory
ConnectionFactory/RefAddr/1/Type=type
ConnectionFactory/RefAddr/1/Encoding=String
ConnectionFactory/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory
ConnectionFactory/RefAddr/2/Type=factory
ConnectionFactory/RefAddr/2/Encoding=String
Change this line accordingly if the broker is not at localhost
ConnectionFactory/RefAddr/3/Content=localhost
ConnectionFactory/RefAddr/3/Type=host
ConnectionFactory/RefAddr/3/Encoding=String
#vhost
ConnectionFactory/RefAddr/4/Content=democonnect
ConnectionFactory/RefAddr/4/Type=vhost
ConnectionFactory/RefAddr/4/Encoding=String
#uname
ConnectionFactory/RefAddr/5/Content=guest
ConnectionFactory/RefAddr/5/Type=username
ConnectionFactory/RefAddr/5/Encoding=String
password
ConnectionFactory/RefAddr/6/Content=guest
ConnectionFactory/RefAddr/6/Type=password
ConnectionFactory/RefAddr/6/Encoding=String
#Port
ConnectionFactory/RefAddr/7/Content=5672
ConnectionFactory/RefAddr/7/Type=port
ConnectionFactory/RefAddr/7/Encoding=String
SSL
ConnectionFactory/RefAddr/8/Content=false
ConnectionFactory/RefAddr/8/Type=ssl
ConnectionFactory/RefAddr/8/Encoding=String
#uri
ConnectionFactory/RefAddr/9/Content=amqp://guest:guest@localhost:5672/democonnect
ConnectionFactory/RefAddr/9/Type=uri
ConnectionFactory/RefAddr/9/Encoding=String
testQueue1 Queue
testQueue1/ClassName=javax.jms.Queue
testQueue1/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory
testQueue1/RefAddr/0/Content=jms/Queue
testQueue1/RefAddr/0/Type=name
testQueue1/RefAddr/0/Encoding=String
testQueue1/RefAddr/1/Content=javax.jms.Queue
testQueue1/RefAddr/1/Type=type
testQueue1/RefAddr/1/Encoding=String
testQueue1/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory
testQueue1/RefAddr/2/Type=factory
testQueue1/RefAddr/2/Encoding=String
testQueue1/RefAddr/3/Content=testQueue1
testQueue1/RefAddr/3/Type=destinationName
testQueue1/RefAddr/3/Encoding=String
testQueue1/RefAddr/4/Content=true
testQueue1/RefAddr/4/Type=amqp
testQueue1/RefAddr/4/Encoding=String
testQueue1/RefAddr/5/Content=testqueue1exchange
testQueue1/RefAddr/5/Type=amqpExchangeName
testQueue1/RefAddr/5/Encoding=String
testQueue1/RefAddr/6/Content=testQueue1
testQueue1/RefAddr/6/Type=amqpRoutingKey
testQueue1/RefAddr/6/Encoding=String
testQueue1/RefAddr/7/Content=testQueue1
testQueue1/RefAddr/7/Type=amqpQueueName
testQueue1/RefAddr/7/Encoding=String
Note: Download the required RabbitMQ JMS client library and put the jars in Integration Server lib/jars directory
Integration Server Settings > Messaging > JNDI Settings
Predefined JNDI Templates → file system
Initial Context Factory → com.sun.jndi.fscontext.RefFSContextFactory
Provider URL → Directory location of the .binding file