How to send a message to another queue manager
Overview
This section describes the simplest way to send a message from one queue manager to another.
Before you do this you need to do the following:
- Check that your chosen communication protocol is available.
- Start the queue managers.
- Start the channel initiators.
- Start the listeners.
You also need to have the correct WebSphere MQ security authorization to create the objects required.
To send messages from one queue manager to another:
- Define the following objects on the source queue manager:
- Sender channel
- Remote queue definition
- Initiation queue (optional)
- Transmission queue
- Dead-letter queue (recommended)
- Define the following objects on the target queue manager:
- Receiver channel
- Target queue
- Dead-letter queue (recommended)
Defining the channels
To send messages from one queue manager to another, you need to define two channels; one on the source queue manager and one on the target queue manager.
- On the source queue manager
- Define a channel with a channel type of SENDER. You need to specify the following:
- The name of the transmission queue to be used (XMITQ attribute).
- The connection name of the partner system (CONNAME attribute).
- The name of the communication protocol you are using (TRPTYPE attribute).
You do not have to specify this. You can leave it to pick up the value from your default channel definition.
- On the target queue manager
- Define a channel with a channel type of RECEIVER, and the same name as the sender channel.
Specify the name of the communication protocol you are using (the TRPTYPE attribute).
You do not have to specify this. You can leave it to pick up the value from your default channel definition.
Note that receiver channel definitions can be generic. This means that if you have several queue managers communicating with the same receiver, the sending channels can all specify the same name for the receiver, and one receiver definition will apply to them all.
When you have defined the channel, you can test it using the PING CHANNEL command. This command sends a special message from the sender channel to the receiver channel and checks that it is returned.
Defining the queues
To send messages from one queue manager to another, you need to define up to six queues; four on the source queue manager and two on the target queue manager.
- On the source queue manager
- Remote queue definition
In this definition you specify the following:
- Remote queue manager name
- The name of the target queue manager.
- Remote queue name
- The name of the target queue on the target queue manager.
- Transmission queue name
- The name of the transmission queue. You do not have to specify this. If you do not, a transmission queue with the same name as the target queue manager is used, or, if this does not exist, the default transmission queue is used. You are advised to give the transmission queue the same name as the target queue manager so that the queue is found by default.
- Initiation queue definition
Optional. It is recommended to use the initiation queue called SYSTEM.CHANNEL.INITQ.
- Transmission queue definition
A local queue with the USAGE attribute set to XMITQ. If you are using the WebSphere MQ for iSeries native interface, the USAGE attribute is *TMQ.
- Dead-letter queue definition--recommended
Define a dead-letter queue to which undelivered messages can be written.
- On the target queue manager
- Local queue definition
The target queue. The name of this queue must be the same as that specified in the remote queue name field of the remote queue definition on the source queue manager.
- Dead-letter queue definition--recommended
Define a dead-letter queue to which undelivered messages can be written.
Sending the messages
When you put messages on the remote queue defined at the source queue manager, they are stored on the transmission queue until the channel is started. When the channel has been started, the messages are delivered to the target queue on the remote queue manager.
Starting the channel
Start the channel on the sending queue manager using the START CHANNEL command. When you start the sending channel, the receiving channel is started automatically (by the listener) and the messages are sent to the target queue. Both ends of the message channel must be running for messages to be transferred.
Because the two ends of the channel are on different queue managers, they could have been defined with different attributes. To resolve any differences, there is an initial data negotiation between the two ends when the channel starts. In general, the two ends of the channel agree to operate with the attributes needing the fewer resources, thus enabling larger systems to accommodate the lesser resources of smaller systems at the other end of the message channel.
The sending MCA splits large messages before sending them across the channel. They are reassembled at the remote queue manager. This is transparent to the user.
An MCA can transfer messages using multiple threads. This process, called pipelining enables the MCA to transfer messages more efficiently, with fewer wait states. This improves channel performance.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.