Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the message from a sent message

Status
Not open for further replies.

morgankejerhag

Programmer
Nov 18, 2008
1
SE
Hi,
Im all new to MQ, so please bear with me if my questions are simple.

I have put a message in a queue by using a MQMessage and a MQPutMessageOptions.

I want to know what the ID of the message that I just put was (for tracking purposes).

If I read the MQMessage.messageId it seems updated from running MQQueue.put. But it is a byte array? What is the actual id?
 
The message ID is a 24-byte field. It CAN be be set by the sending application and should be unique, although this is not disallowed by MQ.

But the normal practice is for the sending (ie. MQPUTting) application to a) specify MQPMO_NEW_MSG_ID in the PUT message options or b) set the message ID to MQMI_NONE (which is low-values).

Then the queue manager will generate a value consisting of 12 bytes based on the queue manager name + 12 bytes based on the system clock. This is available to the application post-MQPUT.

The uniqueness depends on all the queue managers in the network differing in the initial 12 bytes of their names and also on the clocks not being adjusted backwards.

Note that if you are doing request/reply processing you WILL need to know the message ID of the request message sent - its put into the correlation id on the MQGET to retrieve the correlated reply message.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top