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 » Auto generation of CorrelationID in JMS?

Post new topic  Reply to topic
 Auto generation of CorrelationID in JMS? « View previous topic :: View next topic » 
Author Message
jase_t_thomas
PostPosted: Mon Feb 08, 2010 2:39 am    Post subject: Auto generation of CorrelationID in JMS? Reply with quote

Newbie

Joined: 08 Feb 2010
Posts: 6

Hi,

Does anyone know if the correlation ID can be auto-generated using the JMS/MQ interface?

I am aware that using the MQ Java API, it is possible to set the MQC.MQPMO_NEW_CORREL_ID on the MQPutMessageOptions object.

However, I can't see a way to do this automatically in the JMS API interface (with MQ) ?

At the moment, I am randomizing a byte[24] array and setting this manually by using the setJMSCorrelationId() function. I'd prefer to allow MQ to do this if possible.

Anyone know if it is feasible?

Rgds,
J
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 09, 2010 9:13 pm    Post subject: Reply with quote

Grand High Poobah

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

Remember that in JMS the send method automatically generates a new message id. Best practice says:
If the request correlationId is initial (hex 000...) send the reply with the messageid of the request as correlation id.
If the correlationId is set on the request message it is a passthrough to the reply.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rajess_kr
PostPosted: Mon Mar 01, 2010 11:01 am    Post subject: Auto generation of CorrelationID in JMS? Reply with quote

Newbie

Joined: 26 Feb 2010
Posts: 8

did u get get it to work?
Back to top
View user's profile Send private message
jase_t_thomas
PostPosted: Tue Mar 02, 2010 1:10 am    Post subject: Reply with quote

Newbie

Joined: 08 Feb 2010
Posts: 6

No. I found nothing to indicate that it was possible using the JMS/MQ standard.

The comment above from fjb_saper does not answer my question, but merely asks why we are not following a different standard. Of course, it is quite acceptable to use a different standard which is for a request/response to match using the correlation id on both legs of the message.

In the end, I used the Java.Random.nextBytes(), passing in a 24 byte array, along with the setJMSCorrelationId to do this outside of MQ/JMS. Performance profiling indicates this shouldnt be a problem.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 02, 2010 8:30 pm    Post subject: Reply with quote

Grand High Poobah

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

jase_t_thomas wrote:
No. I found nothing to indicate that it was possible using the JMS/MQ standard.

The comment above from fjb_saper does not answer my question, but merely asks why we are not following a different standard. Of course, it is quite acceptable to use a different standard which is for a request/response to match using the correlation id on both legs of the message.

In the end, I used the Java.Random.nextBytes(), passing in a 24 byte array, along with the setJMSCorrelationId to do this outside of MQ/JMS. Performance profiling indicates this shouldnt be a problem.


And if you wanted to ensure uniqueness of the correlation Id I would have suggested that you write a message with short expiry to a queue and use the messageId of that message to populate the correlation id of your request. The queue being written to should be read from at interval x to make sure the expired messages get removed...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Auto generation of CorrelationID 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.