Author |
Message
|
mastanr |
Posted: Mon Aug 01, 2005 12:22 pm Post subject: MessageId |
|
|
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 |
|
 |
wschutz |
Posted: Mon Aug 01, 2005 4:25 pm Post subject: |
|
|
 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 |
|
 |
mastanr |
Posted: Tue Aug 02, 2005 8:07 am Post subject: |
|
|
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 |
|
 |
mastanr |
Posted: Tue Aug 02, 2005 9:11 am Post subject: |
|
|
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 |
|
 |
wschutz |
Posted: Tue Aug 02, 2005 9:29 am Post subject: |
|
|
 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 |
|
 |
mastanr |
Posted: Tue Aug 02, 2005 9:57 am Post subject: |
|
|
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 |
|
 |
wschutz |
Posted: Tue Aug 02, 2005 10:11 am Post subject: |
|
|
 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 |
|
 |
mastanr |
Posted: Tue Aug 02, 2005 11:33 am Post subject: |
|
|
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 |
|
 |
wschutz |
Posted: Tue Aug 02, 2005 11:49 am Post subject: |
|
|
 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 |
|
 |
rebornspririt |
Posted: Tue Aug 02, 2005 11:20 pm Post subject: Watch out! |
|
|
Newbie
Joined: 29 Jul 2005 Posts: 9
|
|
Back to top |
|
 |
|