Author |
Message
|
tricky_knight |
Posted: Fri Apr 15, 2005 6:34 am Post subject: setting mqmd (correl ID) field in JMS |
|
|
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 |
|
 |
jefflowrey |
Posted: Fri Apr 15, 2005 6:56 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Fri Apr 15, 2005 6:59 am Post subject: |
|
|
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 |
|
 |
tricky_knight |
Posted: Fri Apr 15, 2005 7:12 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Fri Apr 15, 2005 7:25 am Post subject: |
|
|
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 |
|
 |
tricky_knight |
Posted: Fri Apr 15, 2005 7:33 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri Apr 15, 2005 7:14 pm Post subject: |
|
|
 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 |
|
 |
clindsey |
Posted: Sat Apr 16, 2005 2:07 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
|
Back to top |
|
 |
webspherical |
Posted: Sat Jan 28, 2006 7:52 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Sat Jan 28, 2006 10:08 am Post subject: |
|
|
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 |
|
 |
webspherical |
Posted: Sun Jan 29, 2006 12:38 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Jan 29, 2006 2:10 pm Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Mon Jan 30, 2006 7:52 pm Post subject: |
|
|
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 |
|
 |
EddieA |
Posted: Mon Jan 30, 2006 10:45 pm Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Tue Jan 31, 2006 2:58 am Post subject: |
|
|
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 |
|
 |
|