Describing messages using the MQMD structure and the MQGET call

 

To identify the message that you want to get from a queue, use the message descriptor structure (MQMD). This is an input/output parameter for the MQGET call. There is an introduction to the message properties that MQMD describes in WebSphere MQ messages, and there is a description of the structure itself in the Application Programming Reference.

If you know which message you want to get from the queue, see Getting a particular message.

If you do not specify a particular message, MQGET retrieves the first message in the queue. The order in which messages are retrieved from a queue describes how the priority of a message, the MsgDeliverySequence attribute of the queue, and the MQGMO_LOGICAL_ORDER option determine the order of the messages in the queue.

If you want to use MQGET more than once (for example, to step through the messages in the queue), set the MsgId and CorrelId fields of this structure to null after each call. This clears these fields of the identifiers of the message that was retrieved.

However, if you want to group your messages, the GroupId must be the same for messages in the same group, so that the call looks for a message having the same identifiers as the previous message in order to make up the whole group.

 

Parent topic:

Getting messages from a queue using the MQGET call


fg12570_