Posted: Thu Jun 06, 2002 4:52 am Post subject: How to get MessageID of the message I send...
Newbie
Joined: 06 Jun 2002 Posts: 2
Hello!
This question may seem a little bit strange.
From an Client application (A) I want to put messages (requests) to an input queue then from an output queue I want to read the right responses.
Application (B) generates responses and to the correlationId of the response is set to the messageId of the request.
When the request is sent the messageId has value MQMI_NONE (0).
The messageId is somehow created (by the queue manager?)
and the message in the queue has an messageId different from MQMI_NONE.
My question:
If the application A does not set messageId can it somehow retrieve messageId of the message it puts into a queue?
Thank you for attention
Bartosz
P.S. Of course I can generate messageId's by myself ... but if many instances put msgs to the same queue may it would be better to rely on the generator by IMQ?
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
The MsgID that MQSeries generates is returned to the caller of the MQPUT operation in the MQMD structure you passed in. Assuming that you set the MQMD.MsgId field to MQMI_NONE then on return, it will contain the 24 bytes of NEW MsgId. You can then copy this to the MQMD CorrelId of the MQGET and specify a matching CortrelId. Make sure that you keep reseting MQMD.MsgId to MQMI_NONE prior to each MQPUT. A common mistake is to forget to reset this and you end up using the same MsgId over and over.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum