Author |
Message
|
rahoor |
Posted: Fri Jan 02, 2009 7:35 pm Post subject: Passing MQMD correlID from Publisher flow to subscriber Flow |
|
|
 Apprentice
Joined: 21 Jul 2003 Posts: 34
|
Using WMB 6.1 on AIX
I have a publish flow
Publish Flow:
MQInputNode -> computNode -> publishNode
The compute node copies the MQMD messageId to the MQMD correlId.
I check the MQMD prior to the publish node, it has correctly copied the messageID to the messageID. However, when the message publishes to the subscriber input queue, the correlID has been changed upon arrival into the subscriber inputNode, I assume by the publish node (?)
Question: What is the best way to pass the publish message correl ID to the subscriber?
thank you in advance for your reply |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 02, 2009 8:33 pm Post subject: Re: Passing MQMD correlID from Publisher flow to subscriber |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rahoor wrote: |
Using WMB 6.1 on AIX
I have a publish flow
Publish Flow:
MQInputNode -> computNode -> publishNode
The compute node copies the MQMD messageId to the MQMD correlId.
I check the MQMD prior to the publish node, it has correctly copied the messageID to the messageID. However, when the message publishes to the subscriber input queue, the correlID has been changed upon arrival into the subscriber inputNode, I assume by the publish node (?)
Question: What is the best way to pass the publish message correl ID to the subscriber?
thank you in advance for your reply |
The better question here would be why does the subscriber need the publisher's correlation ID? Can you please elaborate on your design?
Traditionally in pub/sub the correlation Id is used as one of the means of distinguishing different subscribers of the same topic and is being set by the pub/sub engine.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahoor |
Posted: Sat Jan 03, 2009 8:33 am Post subject: Re: Passing MQMD correlID from Publisher flow to subscriber |
|
|
 Apprentice
Joined: 21 Jul 2003 Posts: 34
|
Quote: |
The better question here would be why does the subscriber need the publisher's correlation ID? Can you please elaborate on your design?
Traditionally in pub/sub the correlation Id is used as one of the means of distinguishing different subscribers of the same topic and is being set by the pub/sub engine.  |
It is a way to distinguish a published message across multiple flows with a restriction that the legacy publishing applications can not be changed. The legacy publishing application can only persist the messageID generated when sending the publication.
The subscriber receives the publication and performs a database update and receives an identity value back (A unique integer generated by the database upon insert and stored as a field along with the data row).
The subscriber doing the insert subsequently stores the identify value passed back by the database in id_queue, which has the correlID it received from the publish flow. Other publications related to this one, across multiple flows can now mqget the id_queue with the correlID of the original publication to receive the identify value.
One possible solution is for the publish flow to receive the publication message and put the received correlId into the data structure of the message. The subscribe flows could then be recoded to look at the correlID value in the data instead of the MQMD.
However I was hoping that I could get around this approach by explicitly telling the publish node to retain the correlID. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jan 03, 2009 10:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
From what you said I understand that you want to use the correlid on the published message as a "thread" identifier across multiple publishers and topics, to be recorded by the DB as an indexed field allowing quick retrieval of a thread.
You should probably put that value into the usr folder of the RFH2. This way the subscribers will see it as a message property (JMS). Remember to use an identifier/value pair.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahoor |
Posted: Sat Jan 03, 2009 3:47 pm Post subject: |
|
|
 Apprentice
Joined: 21 Jul 2003 Posts: 34
|
That should work! Thank you for the recommendation. Since other threads will do a browse with correlId set to the value given by the publisher, I will just need to experiment with:
SET OutputRoot.MQMD.correlID = InputRoot.RFH2.usr.correlID;
to determine how the string type in the usr correlID can be stored in a hex MQMD.correlID as I am sure some type cast or conversion to bitstream may be needed.
For example
instead of :
SET OutputRoot.MQMD.CorrelId = X'4d454e53414a453320202020202020202020202020202020';
something similar to
SET OutputRoot.MQMD.CorrelId = XInputRoot.RFH2.usr.correlID;
should work.
Will let you know after trying.
 |
|
Back to top |
|
 |
rahoor |
Posted: Mon Jan 05, 2009 11:40 am Post subject: |
|
|
 Apprentice
Joined: 21 Jul 2003 Posts: 34
|
rahoor wrote: |
For example
instead of :
SET OutputRoot.MQMD.CorrelId = X'4d454e53414a453320202020202020202020202020202020';
something similar to
SET OutputRoot.MQMD.CorrelId = XInputRoot.MQRFH2.usr.correlID;
should work.
|
SET OutputRoot.MQMD.CorrelId = CAST(InputRoot.MQRFH2.usr.correlID AS BLOB CCSID 1208)
works. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 05, 2009 11:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rahoor wrote: |
rahoor wrote: |
For example
instead of :
SET OutputRoot.MQMD.CorrelId = X'4d454e53414a453320202020202020202020202020202020';
something similar to
SET OutputRoot.MQMD.CorrelId = XInputRoot.MQRFH2.usr.correlID;
should work.
|
SET OutputRoot.MQMD.CorrelId = CAST(InputRoot.MQRFH2.usr.correlID AS BLOB CCSID 1208)
works. |
Caveat with casting as blob. If you have a hex representation of a byte array vs text being cast as BLOB, the results are not the same...
Check it out on the binary level. Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rahoor |
Posted: Mon Jan 05, 2009 5:28 pm Post subject: |
|
|
 Apprentice
Joined: 21 Jul 2003 Posts: 34
|
Good point, as it turns out the CAST in the following statement:
SET OutputRoot.MQMD.CorrelId = CAST(InputRoot.MQRFH2.usr.correlID AS BLOB CCSID 1208)
worked successfully because the MQRFH2.usr.correlID passed from the publisher to the subscriber queue was interpreted to a CHARACTER.
That is, it was a BLOB on the publish side to begin with and somehow got translated into CHARACTER by the time it arrived in the subscriber input queue.
 |
|
Back to top |
|
 |
|