JMS and Websphere MQ


How to connect to Websphere MQ (WMQ) Servers using WMQ Client over JMS ? if the MQ Object definitions on the WMQ Servers are same.
The diagram below shows the components involved when connecting to a WMQ Server using WMQ Client over JMS in PTP mode of communication.

jms-wmq.bmp

WMQ provides a utility called JMSAdmin to configure and bind JMS Admin Objects to JNDI. The JNDI repository can be a file system, a repository hosted in an Application Server or a LDAP server. This choice is dictated by the property in JNDI called “INITIAL CONTEXT FACTORY” used by the JMS client program that would connect to the WMQ Server Queue Manager in question (in the diagram below I show this as the MQConnector component). The “INITIAL CONTEXT FACTORY” property represents the value of starting context to perform directory operations. Besides this parameter the MQConnector requires three more parameters to connect to a queue manager which are mentioned below:

i) Provider URL: The property name representing the value of the context for JNDI operations. The solution proposed in this post uses the filesystem as JNDI repository and thus this value would be the location of the bindings file generated by the JMSAdmin utility.
ii) Queue Connection Factory: The property name representing the value of the request or response queue connection factory.
iii) Queue NAME: The name representing the value of a sender or receiver queue.

The bindings file generated using JMSAdmin utility for each of the WMQ Servers should be made available in different directories (you can create your own mapping between servers and directories following your naming convention). The key is this directory name (absolute file path naming convention is followed) should be the value of the “Provider URL” that will be used by the Client Program (MQConnector) to connect to the WMQ Servers.