Author |
Message
|
sasad |
Posted: Mon Sep 29, 2014 5:15 am Post subject: How to correlate messages? |
|
|
Acolyte
Joined: 30 Apr 2014 Posts: 67
|
Hi everyone,
I have following message flow,
FileInput -> MQOutput -> MQGet -> FileOutput
I have scenario in which multiple files can be processed at same time (multiple thread scenario). My msg flow writes messages on output queues. I have another application which reads msg from out queue and write response on In queue.
My question is how I can differetiate the responses, I want thread 1 to read response of 1st message and thread 2 to read response of 2nd message.
Can anyone please guide me what should I do... any guide on Correlation IDs...
I tried searching on property Correlation ID, but dont understand much... |
|
Back to top |
|
 |
zpat |
Posted: Mon Sep 29, 2014 6:13 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You need to match on the correlid.
However this requires the service which you are calling, to move the MQMD.msgid of the request message, into the MQMD.correlid of the reply message that it returns to you.
Since you can see the generated MQMD.msgid in your flow (after the MQOUTPUT), you will be able to match it using a MQGMO option called MATCH_CORRELID set in a compute node before the MQGET.
This is quite complex programming in WMB and not easy to get right for a beginner. However once you get it working it's a really good model.
Make sure the generated msgid is unique for each message (either generate it yourself or zero the MQMD.msgid field before each MQPUT).
Don't forget to set a max wait limit in the MQGET node, to a suitable value. Ideally messages which are selectively retrieved should have an expiry value set (even if as long as a day) otherwise they can hang around on a queue forever if not comsumed. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Sep 29, 2014 10:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And don't forget that the MQPUT node cannot not participate in the same transaction as the following MQGET node...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
sasad |
Posted: Mon Sep 29, 2014 10:57 pm Post subject: |
|
|
Acolyte
Joined: 30 Apr 2014 Posts: 67
|
@Zpat and @fjb_saper thanks for the replies.
there are two checkboxes in Advanced tab of MQ Output node
1) New Message ID
2) New Correlation ID
Also there are two check boxes in Request tab of MQ Get node,
1) Get by Correlation ID
2) Get by message ID
3) Input MQMD location
4) Input MQ parameters location
Can you please tell what are these for?
Is there any example available for correlation id solution. |
|
Back to top |
|
 |
zpat |
Posted: Tue Sep 30, 2014 2:33 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
What does the toolkit help say about using these node properties? _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
sasad |
Posted: Tue Sep 30, 2014 2:48 am Post subject: |
|
|
Acolyte
Joined: 30 Apr 2014 Posts: 67
|
New Message ID - If you select this check box, WebSphere MQ generates a new message identifier to replace the contents of the MsgId field in the MQMD. This property maps to the MQPMO_NEW_MSG_ID option of the MQPMO of the MQI. Clear the check box if you do not want to generate a new ID.
New Correlation ID - If you select this check box, WebSphere MQ generates a new correlation identifier to replace the contents of the CorrelId field in the MQMD. This property maps to the MQPMO_NEW_CORREL_ID option of the MQPMO of the MQI. Clear the check box if you do not want to generate a new ID.
As you said it is complex programming. Can you guide me to any example or tutorial of these..... I don't want exact solution to my prob but If there is any example of Correlation id, it will help me understand these.. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 30, 2014 2:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sasad wrote: |
Can you guide me to any example or tutorial of these..... I don't want exact solution to my prob but If there is any example of Correlation id, it will help me understand these.. |
Check out the sample provided with the product. Many of the MQ ones use this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sasad |
Posted: Tue Sep 30, 2014 3:17 am Post subject: |
|
|
Acolyte
Joined: 30 Apr 2014 Posts: 67
|
Sorry @Vitor but I can't find any....
Can you name any one please..... |
|
Back to top |
|
 |
zpat |
Posted: Tue Sep 30, 2014 4:33 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Don't forget that here WMB is merely using MQ features.
Look up these MQ features in the MQ documentation if you need more detail.
What does the help for the MQGET node say? _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 01, 2014 7:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sasad wrote: |
Sorry @Vitor but I can't find any....
Can you name any one please..... |
You can't find any relevant samples in all the ones than that come with the toolkit? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|