ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Passing MQMD correlID from Publisher flow to subscriber Flow

Post new topic  Reply to topic
 Passing MQMD correlID from Publisher flow to subscriber Flow « View previous topic :: View next topic » 
Author Message
rahoor
PostPosted: Fri Jan 02, 2009 7:35 pm    Post subject: Passing MQMD correlID from Publisher flow to subscriber Flow Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Fri Jan 02, 2009 8:33 pm    Post subject: Re: Passing MQMD correlID from Publisher flow to subscriber Reply with quote

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
View user's profile Send private message Send e-mail
rahoor
PostPosted: Sat Jan 03, 2009 8:33 am    Post subject: Re: Passing MQMD correlID from Publisher flow to subscriber Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sat Jan 03, 2009 10:10 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rahoor
PostPosted: Sat Jan 03, 2009 3:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
rahoor
PostPosted: Mon Jan 05, 2009 11:40 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 05, 2009 11:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rahoor
PostPosted: Mon Jan 05, 2009 5:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Passing MQMD correlID from Publisher flow to subscriber Flow
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.