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) ;
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) ;