How to make a JMS publish/subscribe connection from IBM Integration Bus to MessageSight
Geza Geleji 270004YEWY Visits (4722)
To create a connection between IBM Integration Bus (IIB) and IBM MessageSight (IMS) through the Publish-Subscribe messaging model of the Java Message Service (JMS), IIB needs to be configured to use the JMS client libraries provided by MessageSight (these are available for download at IBM Fix Central), and to connect to a particular endpoint defined on the appliance.
To demonstrate this capability, we will be using a simple setup consisting of a pair of JMS clients for sending and receiving test messages, an IMS appliance and a loopback flow in IIB. The first client application, the JMS publisher, will publish messages to a JMS topic called 'RequestTopic'. IIB will be subscribing to this topic, and will receive all messages published by the publisher. It will not do any special processing on the messages, but will simply re-publish them to a different topic on IMS, called 'ResponseTopic'. The (very simple) IIB flow to implement this is the following:
The flow consists of a JMS Input and a JMS Output node, connected by a single wire. Both nodes will communicate with the IMS appliance; the JMS Input node will subscribe to 'RequestTopic', and the JMS Output node will publish to 'ResponseTopic'. The messages will be picked up from 'ResponseTopic' by the second JMS client application, the subscriber.
The following diagram is a high-level representation of our simple demonstration, which showcases two basic functions:
The MessageSight "Event Notification" pattern in IBM Integration Toolkit contains a slightly more complex application involving dynamically generated topic names.
Configuring IBM Integration Bus
Having successfully created the JMS loopback flow in IBM Integration Toolkit as described above, we need to configure it appropriately. Let us first have a glance at the 'Basic' tab of the JMS Input node property page:
Basically, all we need to do here is to set the subscription topic to 'RequestTopic'. The 'JMS Connection' tab shows a slightly wider range of settings:
A very similar set of settings apply to the JMS Output node, but here we are setting the publication topic to 'ResponseTopic' on the 'Basic' property page.
We need to select 'IBM MessageSight' as the JMS provider. I will use 'com
The excerpt above defines a single connection factory called 'connFactory1', and two topics: 'RequestTopic' and 'ResponseTopic'. The connection factory is configured to connect to the appliance endpoint listening on port 16102, address 192.168.1.1. If necessary, these parameters may be changed in the lines beginning with 'con
We now need to configure IIB to use the IMS client libraries. This is possible using the 'mqs
The integration node needs to be restarted in order for the changes to take effect. To verify that the configuration changes have been applied, we may use the 'mqs
The output should be similar to the following:
JMSProviders IBM_MessageSight clie
We may now deploy our message flow to the Integration Node, and proceed with configuring the MessageSight appliance.
Configuring IBM MessageSight
The configuration we need to apply to IMS is remarkably simple. We need to define a single message hub with a simple connection policy as follows:
We will use the following messaging policy:
And the following endpoint definition:
Here, we need to make sure that the 'Port' matches the value given in the '.bindings' file provided to IIB (see the section above), that JMS is enabled, and that IIB as well as our client applications will be allowed to connect to the appliance.
We have finished configuring the appliance, and we may now start the publisher and subscriber clients. The messages published by the publisher application should be routed back to the subscriber through MessageSight and IIB.
About the JMS publish/subscribe clients
We are using a pair of standalone Java applications for publishing and subscribing to the JMS topics on IMS. Although we will not delve into their implementation details in this post, we would like to note that we may use the same '.bindings' file that we already provided to IIB as well as the same set of client libraries, making the applications fairly straightforward to implement using the javax.jms.* API.
java.exe -Xms2048M -Xmx2048M -Dja
Conversely, a subscriber may be created as follows:
java.exe -Xms2048M -Xmx2048M -Dja
The above examples assume that the IMS client libraries are installed in the MessageSight subdirectory of the current directory, that the directory called 'C:\JNDI-Directory' contains the '.bindings' file provided in the previous section, and that the test message to be used is contained in the file 'testMessage.xml'. Since no message processing is done, the actual content of the test message is not relevant.