A local definition of a remote queue is a definition on a local queue manager that refers to a queue on a remote queue manager.
You do not have to define a remote queue from a local position, but the advantage of doing so is that applications can refer to the remote queue by its locally-defined name instead of having to specify a name that is qualified by the ID of the queue manager on which the remote queue is located.
An application connects to a local queue manager and then issues an MQOPEN call. In the open call, the queue name specified is that of a remote queue definition on the local queue manager. The remote queue definition supplies the names of the target queue, the target queue manager, and optionally, a transmission queue. To put a message on the remote queue, the application issues an MQPUT call, specifying the handle returned from the MQOPEN call. The queue manager uses the remote queue name and the remote queue manager name in a transmission header at the start of the message. This information is used to route the message to its correct destination in the network.
As administrator, you can control the destination of the message by altering the remote queue definition.
An application needs to put a message on a queue owned by a remote queue manager.
The application connects to a queue manager, for example, saturn.queue.manager. The target queue is owned by another queue manager.
On the MQOPEN call, the application specifies these fields:
Field value | Description |
---|---|
ObjectName
| Specifies the local name of the remote queue object. This defines the target queue and the target queue manager. |
ObjectType
| Identifies this object as a queue. |
ObjectQmgrName
| This field is optional.
If blank, the name of the local queue manager is assumed. (This is the queue manager on which the remote queue definition exists.) |
After this, the application issues an MQPUT call to put a message onto this queue.
On the local queue manager, you can create a local definition of a remote queue using the following MQSC commands:
DEFINE QREMOTE (CYAN.REMOTE.QUEUE) + DESCR ('Queue for auto insurance requests from the branches') + RNAME (AUTOMOBILE.INSURANCE.QUOTE.QUEUE) + RQMNAME (jupiter.queue.manager) + XMITQ (INQUOTE.XMIT.QUEUE)
where:
In either case, the appropriate transmission queue must be defined as a local queue with a Usage attribute specifying that it is a transmission queue (USAGE(XMITQ) in MQSC commands).
Using a local definition of a remote queue is not the only way of putting messages on a remote queue. Applications can specify the full queue name, including the remote queue manager name, as part of the MQOPEN call. In this case, you do not need a local definition of a remote queue. However, this means that applications must either know, or have access to, the name of the remote queue manager at run time.
You can use MQSC commands to display or alter the attributes of a remote queue object, or you can delete the remote queue object. For example:
DISPLAY QUEUE (CYAN.REMOTE.QUEUE)
ALTER QREMOTE (CYAN.REMOTE.QUEUE) PUT(ENABLED)
DELETE QREMOTE (CYAN.REMOTE.QUEUE)
Note: | When you delete a remote queue, you delete only the local representation of the remote queue. You do not delete the remote queue itself or any messages on it. |
A transmission queue is a local queue that is used when a queue manager forwards messages to a remote queue manager through a message channel.
The channel provides a one-way link to the remote queue manager. Messages are queued at the transmission queue until the channel can accept them. When you define a channel, you must specify a transmission queue name at the sending end of the message channel.
The MQSC command attribute USAGE defines whether a queue is a transmission queue or a normal queue.
When a queue manager sends messages to a remote queue manager, it identifies the transmission queue using the following sequence:
For example, the following MQSC command creates a default transmission queue on source.queue.manager for messages going to target.queue.manager:
DEFINE QLOCAL ('target.queue.manager') + DESCR ('Default transmission queue for target qm') + USAGE (XMITQ)
Applications can put messages directly on a transmission queue, or indirectly through a remote queue definition. See also Creating a local definition of a remote queue.