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 » Reply-To Queue Problem

Post new topic  Reply to topic
 Reply-To Queue Problem « View previous topic :: View next topic » 
Author Message
merlin
PostPosted: Wed Jun 02, 2004 8:24 am    Post subject: Reply-To Queue Problem Reply with quote

Novice

Joined: 07 Mar 2004
Posts: 19

hi,
I am stuck on what is probably a simple problem and just down to a basic misunderstanding on my part. From a java program, I am sending a message to a queue on a clustered queue manager (which works fine by the way). However, I've made a recent change as I want a reply message back once the sent message arrives at the remote queue.
So I set up the ReplyToQueue field in the message that I send out according to the attached code. But I don't get a reply message back which I can correlate using the Correlation ID.
Can someone tell me where I'm going wrong please?

MQMessage msg = new MQMessage();
msg.encoding = MQC.MQENC_NATIVE;
msg.format = MQC.MQFMT_STRING;
msg.persistence = MQC.MQPER_PERSISTENT;
msg.messageType = MQC.MQMT_REQUEST;
msg.replyToQueueName = replyToQueueName;
msg.characterSet = 1208;
msg.writeUTF(sr.toString());
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NEW_MSG_ID;
try {
q.put(msg, pmo);
//now get the correl id
byte [] correlId = msg.correlationId;
QRunnerLogger.getLogger().info("Correl ID="+correlId);
//now open the replytoqueue and check for msg with matching correl id
if(replyQ==null){
openQueue(replyToQueueName,true,true);
}
//create new MQMessage obj to receive in reply
MQMessage replyMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
gmo.options = MQC.MQGMO_WAIT;
gmo.waitInterval = waitFor;//max time to wait for bailing
replyMessage.correlationId = correlId;
QRunnerLogger.getLogger().info("About to try to get reply message");
replyQ.get(replyMessage,gmo);
catch (MQException mqe) {
}

I get the MQ Exception com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2033

Help!
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Jun 02, 2004 8:42 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

From the manuals:

"Note:
The queue manager does not enforce the request-reply relationship; this is an application responsibility"

Just because you have set mqmt_request doesnt mean you would get a reply for your request. Since you never asked for a reply.

"However, I've made a recent change as I want a reply message back once the sent message arrives at the remote queue.
"
---The most likely solution for your problem would be to use MQRO_COA so that the receiving end sends a report back to you saying "yes" the message was successfully delivered to the other end.

Take a look at app prog ref manual.

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Wed Jun 02, 2004 8:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Is your reply queue shared in the cluster?

Are there multiple instances of that reply queue shared in the cluster?

Are you sure your server application is setting the correlation ID properly?

Are you sure that you should be matching the correlation id of the request with 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
merlin
PostPosted: Thu Jun 03, 2004 6:57 am    Post subject: Reply with quote

Novice

Joined: 07 Mar 2004
Posts: 19

Thanks for replies, guys.

Jeff, I should have made it clear - the queue to reply to is the SYSTEM.DEFAULT.LOCAL.QUEUE. No, I'm not sure ithe Correl Id is getting set properly or that that is the right one to use - should I use Message Id instead?
Kumar, thanks for the COA idea, I'll give that a try to see if it works.

Marcus
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jun 03, 2004 6:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should, if your server app is coded "properly" according to the request-reply pattern, be checking that the messageID of the Request is equal to the correlationID of the Reply.

So, capture the messageID of the request, and use that as the correlationID to match on.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Jun 03, 2004 9:58 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Two things.

Are you waiting for a long enough period for the Reply to get back.

Use amqsbcg to browse the queue to make sure that you are getting a reply, and the CorrelationID is correctly set.

Actually, Three things.

Quote:
byte [] correlId = msg.correlationId;

Errr. Shoudn't that be: byte [] correlId = msg.messageId;

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
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 » Reply-To Queue Problem
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.