Selecting messages from queues

To get a particular message from a queue, you need to use the MsgId and CorrelId fields of the message descriptor. If you specify Version 2 of the MQMD, the GroupId can also be used. (See Getting a particular message.)

The message identifier is usually generated by the queue manager when the message is put on a queue. The queue manager tries to ensure that message identifiers are unique. However, a WebSphere MQ application can specify a particular value for the message identifier.

You can use the correlation identifier in any way you like. However, an intended use of this field is for applications to copy the message identifier of a request message into the CorrelId field of a reply message.

The group identifier is usually generated by the queue manager when the first message of a group is put onto a queue. The MsgSeqNumber field identifies the position of the message within the group and the Offset field identifies the segments within the message.

Where more than one message meets the combined selection criteria, the MsgDeliverySequence attribute of the queue determines whether messages are selected in FIFO (first in, first out) or priority order. When messages have equal priority, they are selected in FIFO order. For more information, see The order in which messages are retrieved from a queue.

For an example of an application that uses correlation identifiers, see The Credit Check sample.



© IBM Corporation 1993, 2002. All Rights Reserved