Author |
Message
|
Torsten |
Posted: Thu Apr 12, 2007 6:54 am Post subject: How to get a new JMSCorrelationID ? |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
Hi
I'm faced with the somewhat unusual task to have to create a new correlationID when using JMS to send messages.
I've searched this forum and elsewhere witout result.
It's easy enough when using MQAI, because you just do something like this:
Code: |
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options | MQC.MQPMO_NEW_CORREL_ID;
reqQueue.put(mqMessage, pmo);
|
but how to do that via JMS ??
The reason for this, is that we send messages to a BEA Aqualogic Enterprise Service Bus, and that thing has only two reply modes
messageID to messageID via replyToQueue (which we don't want to use)
correlationID to correlationID
Thank you (hopefully)
Torsten  |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 12, 2007 1:47 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Easy use a queue in between. Send the message to that queue, receive the message from that queue. Now you have a messageId you can put into the correlationId.
A new messageId will be assigned when you send the message to it's true destination...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 12, 2007 1:55 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Um.
JMSCorrelationID, really.
I'm sure FJ didn't mean to give your MQ admin conniptions at the thought of creating a queue that was going to be used for the sole purpose of generating unique ids. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 12, 2007 2:58 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jefflowrey wrote: |
Um.
JMSCorrelationID, really.
I'm sure FJ didn't mean to give your MQ admin conniptions at the thought of creating a queue that was going to be used for the sole purpose of generating unique ids. |
Well you can always try the long way with the proprietary JMS properties....(JMS_IBM_...)
Otherwise you could use a single queue (could be dynamic) to put an empty message that expires anyway just to generate the Id to be used as correlId (JMS purist). Or use a unique guid/uuid generator on 24 bytes...
However well behaved JMS server applications handle the problem as following:
If there is a JMSCorrelid it is passthrough from request to reply.
If there is no JMSCorrelid the JMSMessageId of the request is put into the JMSCorrelid of the repy.
Enjoy  _________________ MQ & Broker admin
Last edited by fjb_saper on Thu Apr 12, 2007 3:00 pm; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 12, 2007 3:00 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Actually, the MQ JMS provider will trim the field length to 24 bytes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 12, 2007 3:03 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jefflowrey wrote: |
Actually, the MQ JMS provider will trim the field length to 24 bytes. |
Only if the RFH2 is stripped. Otherwise the MQ Correlation Id will be shorter than the JMS one...(i.e. the first 24 bytes of your JMSCorrelationId) and you may run into surprises if not all of your path is JMS...
I don't remember if this behavior is JMS provider specification or just IBM's way of handling the discrepancy... _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 12, 2007 3:07 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 12, 2007 3:11 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
As always you're the man Jeff. I stand corrected.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 12, 2007 3:13 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, *this* time I double-checked the documentation before spouting off.
Unlike a recent thread where I forgot to check the syntax for PROPAGATE first.. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Torsten |
Posted: Mon Apr 16, 2007 6:10 am Post subject: |
|
|
Newbie
Joined: 20 Jul 2006 Posts: 7 Location: Denmark
|
gentlemen!
thanks for your replies
- hmm, I'm of course aware of the possibility to use a uuid/guid generator - but would prefer not to.
And the solution with an extra send operation is not so elegant
Is the conclusion that "New CorrelationID" not is supported by JMS ???
And, yes (sigh!) this Bealogic bus is not a well-behaved MQ-application - but it has other advantages, so I'm stuck with it (my customer's decision)
I've not been able to find constants named JMS_IBM.XXXX ??
Thanks for the tip of the new
manual, I've just downloaded it, and will look it over
Take care out there
Torsten |
|
Back to top |
|
 |
|