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 » General IBM MQ Support » MessageId

Post new topic  Reply to topic
 MessageId « View previous topic :: View next topic » 
Author Message
mastanr
PostPosted: Mon Aug 01, 2005 12:22 pm    Post subject: MessageId Reply with quote

Novice

Joined: 21 Jul 2005
Posts: 10

Hello:
I am writing a sample MQ client program of type request/reply. The client program I am writing is a Java program using MQ API. The MQ server is on Mainframe and it is version 1.

My problem is when I put a message and I am seeing 2033 error which means no messages found. If I comment my code to match messageId and I get message. I tried to match the messagIds, the one I got from reply queue is different than the one I sent.

The CICS program is reading the options I sent and moving the same thing to reply queue. This program is not disturbing the messageId.

Any help is appreciated. Below is my code.

Thanks.

MQQueueManager qMgr = new MQQueueManager(qManager) ;
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING ;
MQQueue queue = qMgr.accessQueue(requestQueue, openOptions, null, null, null);
MQPutMessageOptions pmo = new MQPutMessageOptions();
MQMessage outMsg = new MQMessage();
outMsg.format = MQC.MQFMT_STRING ;
outMsg.messageFlags = MQC.MQMT_REQUEST ;
outMsg.replyToQueueName = replyToQueue;
outMsg.replyToQueueManagerName = replyToQueueManager ;
String msgString = "DSIMK66017360040SP@RAK ";
outMsg.writeString(msgString);
queue.put(outMsg, pmo);
qMgr.commit();
queue.close();
openOptions = MQC.MQOO_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING ;
MQQueue respQueue = qMgr.accessQueue(replyToQueue, openOptions, null, null, null);
MQMessage respMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = gmo.options + MQC.MQGMO_WAIT ;
//gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
gmo.waitInterval = 20000 ;
//respMessage.correlationId = outMsg.messageId ;
respQueue.get(respMessage, gmo);
String response = respMessage.readString(respMessage.getMessageLength());
System.out.println("The response message is : " + response);
qMgr.commit();
respQueue.close();
qMgr.disconnect();
Back to top
View user's profile Send private message
wschutz
PostPosted: Mon Aug 01, 2005 4:25 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Quote:
The CICS program is reading the options I sent and moving the same thing to reply queue. This program is not disturbing the messageId.
I'd say that the CICS program is not moving the "request" msgid into its "reply" correlid. Since you've set the msgId to a printable string, you should try printing out the correlID to see if its the same thing.
And two other comments:
Quote:
The MQ server is on Mainframe and it is version 1.
You'd better tell you mainframe sysprogs to upgrade NOW and
Code:
outMsg.replyToQueueManagerName = replyToQueueManager ;
you don't need to set the replyToQMgr as it will default to the queue manager your java pgm is connected to.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
mastanr
PostPosted: Tue Aug 02, 2005 8:07 am    Post subject: Reply with quote

Novice

Joined: 21 Jul 2005
Posts: 10

Yes you are right. The CICS program was not moving correct messageId to Reply queue. I will consider the other two comments you made. Thanks for the Help.

wschutz wrote:
Quote:
The CICS program is reading the options I sent and moving the same thing to reply queue. This program is not disturbing the messageId.
I'd say that the CICS program is not moving the "request" msgid into its "reply" correlid. Since you've set the msgId to a printable string, you should try printing out the correlID to see if its the same thing.
And two other comments:
Quote:
The MQ server is on Mainframe and it is version 1.
You'd better tell you mainframe sysprogs to upgrade NOW and
Code:
outMsg.replyToQueueManagerName = replyToQueueManager ;
you don't need to set the replyToQMgr as it will default to the queue manager your java pgm is connected to.
Back to top
View user's profile Send private message
mastanr
PostPosted: Tue Aug 02, 2005 9:11 am    Post subject: Reply with quote

Novice

Joined: 21 Jul 2005
Posts: 10

We changed the cics program and I am receiving the correct messageId. I compared both one I sent and received. They are same. But if I set options like below, I am retrieving no messages. Can any one help .

gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
respMessage.correlationId = outMsg.messageId ;



mastanr wrote:
Yes you are right. The CICS program was not moving correct messageId to Reply queue. I will consider the other two comments you made. Thanks for the Help.

wschutz wrote:
Quote:
The CICS program is reading the options I sent and moving the same thing to reply queue. This program is not disturbing the messageId.
I'd say that the CICS program is not moving the "request" msgid into its "reply" correlid. Since you've set the msgId to a printable string, you should try printing out the correlID to see if its the same thing.
And two other comments:
Quote:
The MQ server is on Mainframe and it is version 1.
You'd better tell you mainframe sysprogs to upgrade NOW and
Code:
outMsg.replyToQueueManagerName = replyToQueueManager ;
you don't need to set the replyToQMgr as it will default to the queue manager your java pgm is connected to.
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Aug 02, 2005 9:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Quote:
We changed the cics program and I am receiving the correct messageId. I compared both one I sent and received. They are same. But if I set options like below, I am retrieving no messages. Can any one help .

gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
respMessage.correlationId = outMsg.messageId ;

Are you confusing messageId and correlID? You're saying "messageId" and coding "correlId".
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
mastanr
PostPosted: Tue Aug 02, 2005 9:57 am    Post subject: Reply with quote

Novice

Joined: 21 Jul 2005
Posts: 10

I was trying with different options and pasted here wrong code. I got this working with matching messageId but not with correlId. May be this is due to our MQ server version 1.

wschutz wrote:
Quote:
We changed the cics program and I am receiving the correct messageId. I compared both one I sent and received. They are same. But if I set options like below, I am retrieving no messages. Can any one help .

gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
respMessage.correlationId = outMsg.messageId ;

Are you confusing messageId and correlID? You're saying "messageId" and coding "correlId".
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Aug 02, 2005 10:11 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Quote:
May be this is due to our MQ server version 1.
Unlikely.
Code:
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
respMessage.correlationId = outMsg.messageId ;
This code will work if the "response" correlId matches the "request" messageId. If it doesn't work, then the only thing this can mean is that they don't match. So, I'd suggest you print out the outMsg.messageId and the respMessage.correlationId after you get the response message to see if this is true.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
mastanr
PostPosted: Tue Aug 02, 2005 11:33 am    Post subject: Reply with quote

Novice

Joined: 21 Jul 2005
Posts: 10

I did printed the messageId and correlId from both request and reply queues and all are same.

wschutz wrote:
Quote:
May be this is due to our MQ server version 1.
Unlikely.
Code:
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
respMessage.correlationId = outMsg.messageId ;
This code will work if the "response" correlId matches the "request" messageId. If it doesn't work, then the only thing this can mean is that they don't match. So, I'd suggest you print out the outMsg.messageId and the respMessage.correlationId after you get the response message to see if this is true.
Back to top
View user's profile Send private message
wschutz
PostPosted: Tue Aug 02, 2005 11:49 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Quote:
Since you've set the msgId to a printable string, you should try printing out the correlID to see if its the same thing.
I see I made a mistake in making that comment
Sooo... normally, msgID is a hex field. Did you print it as hex?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
rebornspririt
PostPosted: Tue Aug 02, 2005 11:20 pm    Post subject: Watch out! Reply with quote

Newbie

Joined: 29 Jul 2005
Posts: 9

You should handle the message id with care and not pass it in and out into String variables like I did once (http://www.mqseries.net/phpBB2/viewtopic.php?t=22796&highlight=). It caused that every 16th message was handled incorrectly. SO don't forget you're working with hex data.

Just some sideline advice
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 » General IBM MQ Support » MessageId
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.