Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verifying the get retrieved the right message on the q

Status
Not open for further replies.

emaster

Programmer
Mar 28, 2002
4
US
I am putting a message on one queue and then I get the message from a different queue. How do I know I have the correct message from the queue? I am using the correlation id and message id but the get message id's do not match the put message id's..but the MQMD id's match for both..I am new to MQ Series so this may be an easy question.

I have copied some of my code below if that helps.

Thanks in advance for any help.

MQMD msgDef = new MQMD();
MQMessage LAA_packet = new MQMessage();
LAA_packet.messageType = MQC.MQMT_REQUEST ;
LAA_packet.format =MQC.MQFMT_STRING ;
LAA_packet.writeString(LAAMsg+LIGAMsg);

MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NEW_MSG_ID | QC.MQPMO_NEW_CORREL_ID | MQC.MQPMO_FAIL_IF_QUIESCING;

mqqueue.put(LAA_packet,pmo);
msgDef.messageId = LAA_packet.messageId;
msgDef.correlationId = LAA_packet.correlationId;

// i print out the id's here
System.out.println("put msg"+LAA_packet.messageId) ;
System.out.println("put msg"+LAA_packet.correlationId) ;
System.out.println("put msg"+msgDef.messageId) ;
System.out.println("put msg"+msgDef.correlationId) ;

MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageType = MQC.MQMT_REPLY ;

MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT;
gmo.waitInterval = 15000;
gmo.matchOptions= MQC.MQMO_MATCH_CORREL_ID;
retrievedMessage.messageId = MQC.MQMI_NONE ;
retrievedMessage.correlationId = msgDef.messageId;

newqueue.get(retrievedMessage, gmo);

// i print them again here but the retrieved does not match
the puts but the msgDef matches
System.out.println(retrievedMessage.messageId) ;
System.out.println(retrievedMessage.correlationId) ;
System.out.println("put msg"+msgDef.messageId) ;
System.out.println("put msg"+msgDef.correlationId) ;

 
Are you sure that the applicaiton that moves the message from mqqueue to newqueue is doing so correctly? In other words, is that application moving the messageID to the correlID as it is supposed to?

Scott. Scott Meridew
Certified MQSeries Specialist,MCSE
MQ Squared Inc.
 
I have contacted the vendor who is responsible for the application taking the message from the queue and sending the reply to the new queue. I am waiting to hear from them. Is there any way I can determine this myself?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top