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 » IBM MQ Java / JMS » setting mqmd (correl ID) field in JMS

Post new topic  Reply to topic
 setting mqmd (correl ID) field in JMS « View previous topic :: View next topic » 
Author Message
tricky_knight
PostPosted: Fri Apr 15, 2005 6:34 am    Post subject: setting mqmd (correl ID) field in JMS Reply with quote

Apprentice

Joined: 12 Mar 2005
Posts: 34

Hi all,

I am looking through the Java manual, and it appears that you must use rfh2 header to set CORRELID?

msg.setJMSCorrelationID("myID");

since the message is being sent to a native MQ system, I set the target client to "MQ" so the rfh2 is being stripped off.

how would I set this correlID i nthis case?

thankyou
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 15, 2005 6:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should go back to the Using Java manual, and examine the section on mapping JMS headers to MQ headers.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 15, 2005 6:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, you shouldn't set the Correlation ID.

Everyone who has ever tried this has run into trouble, in my experience.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
tricky_knight
PostPosted: Fri Apr 15, 2005 7:12 am    Post subject: Reply with quote

Apprentice

Joined: 12 Mar 2005
Posts: 34

not sure if you understood my problem,
JMS to MQ (set correlationID in MQMD)..

and the section you spoke of the manual is the exact section I am referring too.


I am using rfutil to view the MQMD of the message that is coming from the j2ee system and the correlationID field is BLANK when the the MQ native app recieves it..

there is a messageID, and I though THAT is the one you cant mess with. There should be a way that I can set this correlID field and the native MQ app can read it from the mqmd.. WITHOUT using rfh2

you are saying no has ever achieved this in your experience?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 15, 2005 7:25 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What I'm saying is that it's a bad idea to use the Correlation ID for whatever you are trying to use it for. Unless you're doing request/reply.

Not that it can't be done.

A search here for Correlation ID should give you enough source snippets to be "successfull" at setting the ID.

And the documentation section indicates that the correlation ID will be set in the MQMD, not the Rfh2.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
tricky_knight
PostPosted: Fri Apr 15, 2005 7:33 am    Post subject: Reply with quote

Apprentice

Joined: 12 Mar 2005
Posts: 34

great. That was the answer that I needed, 'that it CAN be done'

because yes, I apologize I failed to mention is is a request/reply scenario.

and the section you are refferring to, I must use bytes

msg.setJMSCorrelationIDAsBytes(correlStr.getBytes());

not just passing a string to the method, that doesnt appear to work.

I will check out this site and search for someone doing the same thing, it should just be a one-liner..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Apr 15, 2005 7:14 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Not quite right. In JMS you can set the correlation ID using a string.
I believe however that the string needs to be the Hex representation of the bytes in the array.

Enjoy
Back to top
View user's profile Send private message Send e-mail
clindsey
PostPosted: Sat Apr 16, 2005 2:07 pm    Post subject: Reply with quote

Knight

Joined: 12 Jul 2002
Posts: 586
Location: Dallas, Tx

Take a look at the sample code on the IBM PartnerWorld site at http://www.developer.ibm.com/tech/sampmq.html. Search down the list for mqjmssrv.java. It does what you are trying to accomplish.

Charlie
Back to top
View user's profile Send private message
webspherical
PostPosted: Sat Jan 28, 2006 7:52 am    Post subject: Reply with quote

Acolyte

Joined: 15 Aug 2005
Posts: 50

So, if using mq5.3 and base mq api, and you wanted to send a message from a windows machine to iseries, and you placed "MYID" in the correlId of the mqmd on the win side, you must simply convert "MYID" as bytes and it the iSeries getApp should be able to read the correlId "MYID" fine?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sat Jan 28, 2006 10:08 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

webspherical wrote:
So, if using mq5.3 and base mq api, and you wanted to send a message from a windows machine to iseries, and you placed "MYID" in the correlId of the mqmd on the win side, you must simply convert "MYID" as bytes and it the iSeries getApp should be able to read the correlId "MYID" fine?


NO.

"MYID" is character based data. If you set the bytes of the correlation ID to the bytes that represent "MYID" in the windows character set, when you get them on the iSeries machine, they will still be the same bytes.

These will be different bytes than the bytes that represent "MYID" in the iSeries character set.

Don't use correlation ID for application or business level identifiers.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
webspherical
PostPosted: Sun Jan 29, 2006 12:38 pm    Post subject: Reply with quote

Acolyte

Joined: 15 Aug 2005
Posts: 50

thank you for the reply,

that does make sense, but couldnt you specify the CCSID in the mqmd also to iseries charcodeset and then it would be able to read the correlID correctly as "MYID" ?

It seems there would be some way to achieve this from base MQ java api and JMS, but you are saying it is not possible.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jan 29, 2006 2:10 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

If you look at the correlation Id as just an identifier it does not matter which CCSID it would be in, or for that matter in which format it is at all.

As a byte array you will have to match it byte for byte. Now what looks like "MY ID" would have a different value byte for byte in a different CCSID and defeat the purpose of an anonymous identifier.

As the byte array is not translated from one CCSID to the other it really constitues a truely anonymous identifier. Whatever system the byte to byte comparison will return true only if the bytes match and the byte representation is the only one that is really common across systems.
No problem with high/low byte precedence like in numbers and changing values like in character sets. Just look at the bytes in the array and the position in the array and your comparison is true across all platforms that MQ is certified on.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Jan 30, 2006 7:52 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No character set conversion is ever performed on the Correlation ID or the Message ID (or most of the other, if not all of the other) fields of the MQMD.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Mon Jan 30, 2006 10:45 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
No character set conversion is ever performed on the Correlation ID or the Message ID (or most of the other, if not all of the other) fields of the MQMD

The only fields that no conversion is done are the ones defined as MQBYTE. The others, MQCHAR and MQLONG, are always converted.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 31, 2006 2:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

EddieA wrote:
The only fields that no conversion is done are the ones defined as MQBYTE. The others, MQCHAR and MQLONG, are always converted.

I knew I should have double-checked that. (and maybe not been posting so late at night, either... (what do you mean, "or this early in the morning?" ))
_________________
I am *not* the model of the modern major general.
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 » IBM MQ Java / JMS » setting mqmd (correl ID) field in JMS
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.