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 » How to get a new JMSCorrelationID ?

Post new topic  Reply to topic
 How to get a new JMSCorrelationID ? « View previous topic :: View next topic » 
Author Message
Torsten
PostPosted: Thu Apr 12, 2007 6:54 am    Post subject: How to get a new JMSCorrelationID ? Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 12, 2007 1:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 12, 2007 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 12, 2007 2:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 12, 2007 3:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 12, 2007 3:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 12, 2007 3:07 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No, actually, only if you set it to a String, rather than a Byte[].

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/uj25470_.htm

Also, notice that the Using Java manual has been significantly reworked with the introduction of 6.0.2.1 and the inclusion of the JCA Adapter.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Apr 12, 2007 3:11 pm    Post subject: Reply with quote

Grand High Poobah

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

jefflowrey wrote:
No, actually, only if you set it to a String, rather than a Byte[].

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/uj25470_.htm

Also, notice that the Using Java manual has been significantly reworked with the introduction of 6.0.2.1 and the inclusion of the JCA Adapter.


As always you're the man Jeff. I stand corrected.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 12, 2007 3:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Torsten
PostPosted: Mon Apr 16, 2007 6:10 am    Post subject: Reply with quote

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
Quote:
Using Java
manual, I've just downloaded it, and will look it over

Take care out there
Torsten
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 » How to get a new JMSCorrelationID ?
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.