IBM MQ link sample configuration
This sample configuration illustrates how we can use an IBM MQ link to connect WebSphere Application Server service integration messaging to IBM MQ messaging.
An IBM MQ link connects one service integration messaging engine, called the gateway messaging engine, to one IBM MQ queue manager or queue-sharing group, called the gateway queue manager. All messaging engines in the service integration bus use the gateway messaging engine to route messages to and from the IBM MQ network; all queue managers and queue-sharing groups in the IBM MQ network use the gateway queue manager to route messages to and from the service integration bus.
Typically, an IBM MQ link consists of two TCP/IP connections:
- The IBM MQ link sender channel, which carries messages from service integration to IBM MQ.
- The IBM MQ link receiver channel, which carries messages from IBM MQ to service integration.
IBM MQ calls these TCP/IP connections message channels, a receiver channel which connects to the IBM MQ link sender channel and a sender channel which connects to the IBM MQ link receiver channel. The following figure shows a configuration like the one just described, with a IBM MQ link sender channel called BUS1.TO.QM01 and an IBM MQ link receiver channel called QM01.TO.BUS1.
If we only require messages to flow in one direction, we need only define one TCP/IP connection. For example, an IBM MQ link sender channel in service integration that connects to a receiver channel in IBM MQ is enough to support message flow from service integration to IBM MQ. However, this sample builds a configuration that allows messages to flow in both directions.
Sample configuration context
The purpose of this sample is to connect a WAS configuration to an IBM MQ configuration so that asynchronous messages can flow in both directions between the two messaging systems. The sample assumes that we have already set up a WAS configuration like this:
- An application server called server1 located on a node called London. In a Network Deployment, server1 might be one of several servers in a cell and might be one of several servers in a cluster, but this sample is equally applicable to a base deployment containing just one application server.
- The IP host name for the server London is LONDON.
- A service integration bus called BUS1.
- server1 is a member of BUS1; the messaging engine it contains is called London.server1-BUS1.
- A queue-type bus destination called ServiceIntegrationQueue1, which is one of the destinations in BUS1.
The sample also assumes that we already have an IBM MQ configuration like this:
- Queue managers called QM01 and QM02 which are part of a network of interconnected IBM MQ queue managers and queue-sharing groups. If we have only one queue manager then we can ignore references to QM02 in this sample.
- The IP host name for the server where QM01 runs is PARIS.
- A queue called WMQ11 which is located on QM01 and a queue called WMQ21 which is located on QM02. There might be many other queues defined in the IBM MQ network but this sample is concerned only with the two IBM MQ queues that we are going to access from WAS.
You select London.server1-BUS1 to be the gateway messaging engine and QM01 to be the gateway queue manager.
Sample configuration for the connections
This section describes the settings that you or your IBM MQ administrator need to configure for the connections:
- The commands that your IBM MQ administrator uses to configure the IBM MQ components that correspond to the IBM MQ link:
- The sender channel
- The receiver channel
- The transmission queue
For JMS programs, the IBM MQ administrator also defines a JMS destination that identifies the queue in the service integration bus. Refer to the IBM MQ documentation for more details about these commands.
- The parameters needed when using the WAS administrative console to configure:
- A foreign bus connection, which includes the foreign bus representing the network of IBM MQ queue managers and queue-sharing groups, and the IBM MQ link representing the connection to that network
- JMS destinations that identify queues in the IBM MQ network
After configuring and activating these components the applications can exchange messages between WAS service integration messaging and IBM MQ messaging. Optionally we can configure additional administrative artifacts that allow you more detailed control over the queues and destinations, see Sample configuration for the destinations.
Your IBM MQ administrator chooses the name for the sender channel, which in this sample is QM01.TO.BUS1.
- IBM MQ command to configure the sender channel
DEFINE CHL(QM01.TO.BUS1) + CHLTYPE(SDR) + TRPTYPE(TCP) + CONNAME('LONDON(5558)') + XMITQ(BUS1)The CONNAME parameter specifies the IP host and port of the gateway messaging engine.
The XMITQ parameter specifies the name of the transmission queue, which is normally the same as the virtual queue manager name of the service integration bus, which is preferably the same as the bus name.
Your IBM MQ administrator chooses the name for the receiver channel, which in this sample is BUS1.TO.QM01.
- IBM MQ command to configure the receiver channel
DEFINE CHL(BUS1.TO.QM01) + CHLTYPE(RCVR) + TRPTYPE(TCP)
- IBM MQ command to configure the transmission queue
DEFINE QL(BUS1) + USAGE(XMITQ)Your IBM MQ administrator chooses the name for the transmission queue, but it is convenient to use the name of the service integration bus BUS1. If the service integration bus name is not a valid IBM MQ queue manager name then the WAS administrator must define a different virtual queue manager name for use here.
Your IBM MQ JMS applications can use this JMS destination to send messages to the service integration bus destination ServiceIntegrationQueue1 in BUS1.
- IBM MQ JMSAdmin command to configure the JMS destination
DEFINE Q(ServiceIntegrationQueue1) + QMGR(BUS1) + QUEUE(ServiceIntegrationQueue1)
- WAS parameters for the foreign bus connection
- We configure a foreign bus connection as part of the topology of the service integration bus. For this sample, the service integration bus is BUS1 and the foreign bus connection uses the following settings:
There are other options in the wizard relating to publish/subscribe messaging and security. Leave these settings to default.
Setting Value Bus connection type Direct connection Foreign bus type IBM MQ Messaging engine to host the connection London.server1-BUS1 Virtual queue manager name BUS1 (use the name of the local bus) Foreign bus name QM01 (use the name of the IBM MQ gateway queue manager) MQ link name TO.QM01 Enable Service integration bus to IBM MQ message flow Checked (default) IBM MQ receiver channel name BUS1.TO.QM01 Host name PARIS Port 1414 Enable IBM MQ to Service integration bus message flow Checked (default) IBM MQ sender channel name QM01.TO.BUS01
- WAS parameters for JMS destinations
- We configure JMS destinations to allow service integration JMS applications to access queues in the IBM MQ network. This sample needs JMS destinations for queue WMQ11 on queue manager QM01, and for queue WMQ21 on queue manager QM02.
These JMS destinations are IBM MQ queues but for the purposes of this sample we are accessing these queues from service integration JMS programs so define JMS destinations for the default messaging provider (service integration) not for the IBM MQ JMS provider.
For WMQ11, configure the following parameters:
Leave all other settings to default.
Parameter Value Name WMQ11 JNDI name jms/WMQ11 Bus name QM01 Queue name WMQ11 For WMQ21, configure the following parameters:
Leave all other settings to default.
Parameter Value Name WMQ21 JNDI name jms/WMQ21 Bus name QM01 Queue name WMQ21@QM02
Sample configuration for the destinations
The sample JMS destinations in Sample configuration for the connections point directly to the corresponding IBM MQ queues and service integration destinations. If we prefer, we can configure additional components so that:
- The IBM MQ JMS destination points to an IBM MQ queue (actually a remote or alias queue) which points to the service integration destination.
- The service integration JMS destinations point to service integration destinations (actually foreign or alias destinations) which point to the IBM MQ queues.
Refer to the IBM MQ documentation for information about when and how to define remote and alias queues.
- WAS parameters for foreign destinations
- We configure foreign destinations for IBM MQ queues to allow control over how service integration applications access each queue. For example, we can configure foreign destinations for each of two queues and specify that service integration includes an MQRFH2 header in messages to one queue but not to the other.
We configure foreign destinations as destination resources of the service integration bus.
For WMQ11, configure the following parameters:
Leave all other settings to default.
Parameter Value Identifier WMQ11 Bus QM01 For WMQ21, configure the following parameters:
If the foreign destination is an IBM MQ destination, the identifier must be in the form qName@qmName where qName is the name of the queue and qName is the name of the queue manager. For this example, the identifier for WMQ21 on queue manager QM02 is WMQ21@QM02.
Parameter Value Identifier WMQ21@QM02 Bus QM01 Leave all other settings to default.
After defining these foreign destinations we can, for example, set the _MQRFHAllowed custom property for either destination or both, as required.