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 » correlation id issue

Post new topic  Reply to topic
 correlation id issue « View previous topic :: View next topic » 
Author Message
Sam Uppu
PostPosted: Sat Aug 20, 2011 3:27 pm    Post subject: correlation id issue Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

Hi guys,

Based upon our requirement, I have to pass the correlation id of input message in payload. I have casted the correlationid field to char and assiged it to xml_correlid element of xml request and dropped to frontend application queue.

The frontend application processes the message and will build xml response with the xml_correlid element same as what is there in request.

When the response arrives on the response flow of message broker, I casted the xml_correlid to BLOB and assigned it to OutputRoot.MQMD.CorrelID.

When I saw the correlation ID in MQMD, i see it is not similar to the original one. The number of characters is also not same.

I defined the xml_correlid element as string.


Can you guy spls help on how to save the correlation id in request message and use it in response flow.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Aug 20, 2011 4:26 pm    Post subject: Re: correlation id issue Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sam Uppu wrote:
I have casted the correlationid field to char


It's not a character field. It's a byte array.

Sam Uppu wrote:
I defined the xml_correlid element as string.


It's not a string either.

Sam Uppu wrote:
Can you guy spls help on how to save the correlation id in request message and use it in response flow.


Store it as is in the XML (base64?)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sam Uppu
PostPosted: Sat Aug 20, 2011 6:26 pm    Post subject: Re: correlation id issue Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

Vitor wrote:

Store it as is in the XML (base64?)


So, I need to store the correlationId as is in XML and later in response flow, I can just retrieve and assign to OutputRoot.MQMD.CorrelId.

I tried this yesterday and got some error saying MQMD cannot be char.

Also what should be the datatype for xml element used?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Aug 20, 2011 9:46 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

As Vitor has said, the CorrelId (and MsgId and GroupId) are NOT human readable fields. They may look it but they are not.

If you doubt this, take a look at the way they are defined in the WMQ header file cmqc.h

So the question remains as to how you can include them in an XML structure in a form that you can use later in an MQMD.

Encode it as Base64 (in ESQL in V7.0.0.2) and then tag the XML field type as Base64Binary in your XSD.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Sam Uppu
PostPosted: Sun Aug 21, 2011 4:36 pm    Post subject: Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

smdavies99 wrote:

Encode it as Base64 (in ESQL in V7.0.0.2) and then tag the XML field type as Base64Binary in your XSD.



Vitor/samdavies99,

Thank you. Will try the option suggested.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Aug 22, 2011 5:40 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Sam -- look in source code from June 2010. You will find example of representing the CorrelId as a string.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Sam Uppu
PostPosted: Mon Aug 22, 2011 7:32 am    Post subject: Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

I am not with the same client.

Last edited by Sam Uppu on Mon Aug 22, 2011 7:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Sam Uppu
PostPosted: Mon Aug 22, 2011 7:34 am    Post subject: Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

lancelotlinc wrote:
Sam -- look in source code from June 2010. You will find example of representing the CorrelId as a string.


Hey,
I am not with the same client.

Thanks
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Aug 22, 2011 8:01 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Code:
String refCorrelId = new String();
   
for( int i = 0; i < 24; i++ ){
     
  String iHexStr = Integer.toHexString( msg.correlationId[i] );
  if ( iHexStr.length()>2 ) iHexStr = iHexStr.substring( iHexStr.length()-2 );
  if ( iHexStr.length()<2 ) refCorrelId = refCorrelId + "0";
  refCorrelId = refCorrelId + iHexStr;     
     
}

_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Aug 22, 2011 8:05 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
Code:
String refCorrelId = new String();
   
for( int i = 0; i < 24; i++ ){
     
  String iHexStr = Integer.toHexString( msg.correlationId[i] );
  if ( iHexStr.length()>2 ) iHexStr = iHexStr.substring( iHexStr.length()-2 );
  if ( iHexStr.length()<2 ) refCorrelId = refCorrelId + "0";
  refCorrelId = refCorrelId + iHexStr;     
     
}


of course, in ESQL, this is just CAST(InputRoot.MQMD.CorrelId AS STRING).

And then a bit of substringing to remove the X' and ' that wrap it.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Aug 22, 2011 11:58 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Definately the ESQL use case is much more efficient from a programmatic perspective, unless you want to use log4j to record the CorrelId.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Aug 22, 2011 12:02 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lancelotlinc wrote:
unless you want to use log4j to record the CorrelId.


Which the OP has given no indication of, intending it seems to use it to correlate a response.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sam Uppu
PostPosted: Mon Aug 22, 2011 7:03 pm    Post subject: Reply with quote

Yatiri

Joined: 11 Nov 2008
Posts: 610

Hi All,

Thanks for all your suggestions.

I used base64 encoding as suggested and it worked.

Thanks
Sam
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 » correlation id issue
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.