WebSphere MQ link sample configuration
This sample configuration illustrates how we can use a WebSphere MQ link to connect WebSphere Application Server service integration messaging to WebSphere MQ messaging.
A WebSphere MQ link connects one service integration messaging engine, called the gateway messaging engine, to one WebSphere 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 WebSphere MQ network; all queue managers and queue-sharing groups in the WebSphere MQ network use the gateway queue manager to route messages to and from the service integration bus.
Typically, a WebSphere MQ link consists of two TCP/IP connections:
- The WebSphere MQ link sender channel, which carries messages from service integration to WebSphere MQ.
- The WebSphere MQ link receiver channel, which carries messages from WebSphere MQ to service integration.
WebSphere MQ calls these TCP/IP connections message channels, a receiver channel which connects to the WebSphere MQ link sender channel and a sender channel which connects to the WebSphere MQ link receiver channel. The following figure shows a configuration like the one just described, with a WebSphere MQ link sender channel called BUS1.TO.QM01 and a WebSphere 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, a WebSphere MQ link sender channel in service integration that connects to a receiver channel in WebSphere MQ is enough to support message flow from service integration to WebSphere 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 a WebSphere 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 you already have a WebSphere MQ configuration like this:
- Queue managers called QM01 and QM02 which are part of a network of interconnected WebSphere 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 WebSphere MQ network but this sample is concerned only with the two WebSphere MQ queues that you are going to access from WebSphere Application Server.
You select London.server1-BUS1 to be the gateway messaging engine and QM01 to be the gateway queue manager.
Sample configuration for the connections
- The commands that the WebSphere MQ administrator uses to configure the WebSphere MQ components that correspond to the WebSphere MQ link:
- The sender channel
- The receiver channel
- The transmission queue
For JMS programs, the WebSphere MQ administrator also defines a JMS destination identifying queue in the service integration bus. Refer to the WebSphere MQ documentation for more details about these commands.
- The parameters that we need when you use the WAS console to configure:
- A foreign bus connection, which includes the foreign bus representing the network of WebSphere MQ queue managers and queue-sharing groups, and the WebSphere MQ link representing the connection to that network
- JMS destinations that identify queues in the WebSphere MQ network
After you configure and activate these components the applications can exchange messages between WebSphere Application Server service integration messaging and WebSphere 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.
- WebSphere MQ command to configure the sender channel
DEFINE CHL(QM01.TO.BUS1) + CHLTYPE(SDR) + TRPTYPE(TCP) + CONNAME('LONDON(5558)') + XMITQ(BUS1)Your WebSphere MQ administrator chooses the name for the sender channel, which in this sample is QM01.TO.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.
- WebSphere MQ command to configure the receiver channel
DEFINE CHL(BUS1.TO.QM01) + CHLTYPE(RCVR) + TRPTYPE(TCP)Your WebSphere MQ administrator chooses the name for the receiver channel, which in this sample is BUS1.TO.QM01.
- WebSphere MQ command to configure the transmission queue
DEFINE QL(BUS1) + USAGE(XMITQ)Your WebSphere 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 WebSphere MQ queue manager name then the WAS administrator must define a different virtual queue manager name for use here.
- WebSphere MQ JMSAdmin command to configure the JMS destination
DEFINE Q(ServiceIntegrationQueue1) + QMGR(BUS1) + QUEUE(ServiceIntegrationQueue1)Your WebSphere MQ JMS applications can use this JMS destination to send messages to the service integration bus destination ServiceIntegrationQueue1 in BUS1.
- WebSphere Application Server parameters for the foreign bus connection
- You 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 WebSphere 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 WebSphere MQ gateway queue manager) MQ link name TO.QM01 Enable Service integration bus to WebSphere MQ message flow Checked (default) WebSphere MQ receiver channel name BUS1.TO.QM01 Host name PARIS Port 1414 Enable WebSphere MQ to Service integration bus message flow Checked (default) WebSphere MQ sender channel name QM01.TO.BUS01
- WebSphere Application Server parameters for JMS destinations
- You configure JMS destinations to allow service integration JMS applications to access queues in the WebSphere MQ network. This sample needs JMS destinations for queue WMQ11 on queue manager QM01, and for queue WMQ21 on queue manager QM02.
Note that these JMS destinations are WebSphere MQ queues but for the purposes of this sample you are accessing these queues from service integration JMS programs so we need to define JMS destinations for the default messaging provider (service integration) not for the WebSphere 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 WebSphere MQ queues and service integration destinations. If we prefer, we can configure additional components so that:
- The WebSphere MQ JMS destination points to a WebSphere 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 WebSphere MQ queues.
Refer to the WebSphere MQ documentation for information about when and how to define remote and alias queues.
- WebSphere Application Server parameters for foreign destinations
- You configure foreign destinations for WebSphere 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.
You 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 a WebSphere 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 you define these foreign destinations we can, for example, set the _MQRFHAllowed custom property for either destination or both, as required.
Reference topic