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 » Matching reply message with request message in JMS

Post new topic  Reply to topic
 Matching reply message with request message in JMS « View previous topic :: View next topic » 
Author Message
priyasharma
PostPosted: Fri Apr 09, 2004 6:24 am    Post subject: Matching reply message with request message in JMS Reply with quote

Novice

Joined: 09 Apr 2004
Posts: 10

Can somebody tell me about the concept of matching reply message with request message in JMS??I have an idea that i need to set correlation id while sending the message at sender side.On the receiver end,while sending back the reply,do I need to again set correlation id or do I need not set anything while sending back reply??I am not clear with the concept.Please help me.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 09, 2004 6:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's the same in JMS as it is in everything else. The requestor keeps track of the message ID for the request message, and matchs that against the correlation ID of the reply message.

Code:
//Send request
m_QueueSender.send(
            message,
            JMSC.MQJMS_PER_QDEF,
            JMSC.MQJMS_PRI_QDEF,
            60 * 60 * 1000);
String msgID = message.getJMSMessageID();
//Wait for Reply
m_QueueReceiver = qRcvrSession.createReceiver(replyQueue, "JMSCorrelationID='"+corrID+"'");
      TextMessage replyMsg = (TextMessage) m_QueueReceiver.receive(60*60 * 100);
The server application copies the message ID from the request message into the correlation ID of the reply.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
priyasharma
PostPosted: Fri Apr 09, 2004 6:50 am    Post subject: Reply with quote

Novice

Joined: 09 Apr 2004
Posts: 10

Thanks a lot.
Back to top
View user's profile Send private message
priyasharma
PostPosted: Fri Apr 09, 2004 7:23 am    Post subject: Reply with quote

Novice

Joined: 09 Apr 2004
Posts: 10

Do I need to declare a message of type ObjectMessage if this was my reply message type and invoke getJMSCorrelationId method on this instance before following line :
m_QueueReceiver = qRcvrSession.createReceiver(replyQueue, "JMSCorrelationID='"+corrID+"'");
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 09, 2004 7:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Actually, there's a slight mistake in the code I posted.

I copied the code from something that has the send in one method and the wait for reply in another.

The field in my code called 'msgID' is the same as the field called 'corrID'.

So use one or the other in both places.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
priyasharma
PostPosted: Fri Apr 09, 2004 7:41 am    Post subject: Reply with quote

Novice

Joined: 09 Apr 2004
Posts: 10

ya,now its working.Thanks again.
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 » Matching reply message with request message 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.