View previous topic :: View next topic
|
Author |
Message |
Sathiyendran
New User
Joined: 17 Jul 2015 Posts: 5 Location: India
|
|
|
|
Need to send a message to the another application with MsgId and CorrelId , this message require a response. Below option was used in cobol code
MOVE MQMT-REQUEST TO MQMD-TYPE
MOVE MQMI-NONE TO MQMD-MSD-ID
MOVE MQCI-NONE TO MQMD-CORRELID
After writing the the data thru MQPUT/MQPUT1, we need to retrieve the corresponding response from Reply MQ. If we use below option, how program knows this a reponse for the earlier message sent.
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
CALL 'MQGET' USING MQ-HCONN
MQ-NATIVE-HOBJ
MQMD
MQGMO
how source system know the MsgId and CorrelId for the each message sent to destination application ? because source system must know the MsgId and CorrelId to read the corresponding response from Reply MQ |
|
Back to top |
|
|
Sathiyendran
New User
Joined: 17 Jul 2015 Posts: 5 Location: India
|
|
|
|
This was the code written to send a message to another application.
MOVE WS-QUEUE-ALIAS TO MQOD-OBJECTNAME.
MOVE WS-REPLY-QUEUE-ALIAS TO MQMD-REPLYTOQ
MOVE SPACES TO MQMD-REPLYTOQMGR
MOVE MQMT-REQUEST TO MQMD-MSGTYPE
MOVE MQMI-NONE TO MQMD-MSGID
MOVE MQMI-NONE TO MQMD-CORRELID
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.
COMPUTE MQPMO-OPTIONS = MQPMO-SYNCPOINT
+ MQPMO-NEW-MSG-ID
+ MQPMO-NEW-CORREL-ID
+ MQPMO-FAIL-IF-QUIESCING.
DISPLAY 'NEW MSG ID : ' MQMD-MSGID
DISPLAY 'NEW COR ID : ' MQMD-CORRELID
CALL 'MQPUT1' USING MQ-HCONN,
MQ-OBJ-DESCRIPTOR,
MQ-MSG-DESCRIPTOR,
MQ-PUT-OPTIONS,
MQ-MESSAGE-LENGTH,
MQ-MESSAGE-DATA,
MQ-COMPLETION-CODE,
MQ-REASON.
Please review and update whether the above code will generate MsgId and correlId and sent to another app. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
What is wrong with your testing system? |
|
Back to top |
|
|
Sathiyendran
New User
Joined: 17 Jul 2015 Posts: 5 Location: India
|
|
|
|
I'm able to place a message successfully. When I need to retrieve the corresponding response from Reply MQ, I would need the MsgId and CorrelId.
how do I know these ?
Receiver might received the MsgId and CorrelId and they will reply based on this but when we retrieve we need to supply the ids to get corresponding response .. correct ? |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
The process for matching MsgId/CorrelId is very straightforward and requires collaboration between the message sender (client) and the responder (server).
By coding
Code: |
MOVE MQMI-NONE TO MQMD-MSGID.
|
the client MQPUT(1) causes MQ to populate the MsgId field in the request message descriptor with a value unique to that QManager. This then flows with the message to the server.
At the server side, the receiving application's MQGET retrieves this MsgId and the application then places it in the CorrelId field of the reply message's message descriptor.
At the client side, the client application places the MsgId which was generated (available after the MQPUT(1)) in the CorrelId field of the message descriptor for the MQGET.
Since the MsgId and CorrelId are being moved between request and response, it is good practice to have separate message descriptors for each in the applications.
Hope this clarifies,,
Garry. |
|
Back to top |
|
|
|