Hi everybody,
I have a problem reading from a queue to get a message with an specific ID. My platform MQSeries5.2.1 using Java.
The issue i want to resolve is: I put a message on a queue1 to query a database, then, a server listening prgm. is reading the queue1, getting the message's text to query a database and return the resultet putting a message on a queue2. So, the client who made the query petition on a queue1, is reading the queue2 to seek for the message that contains the resultet. (In all process, i'm storing the messageId and correlationID trough MQMD Message Descriptor)
The problem is when i look for the message id on a queue2 i always get the first message on the queue
//my client code is pretty much like this....
class myClass{
private MQMD msgDef = new MQMD();
//Put message on queue1
private void putMessage(String pstrQry){
MQMessage msgPut = new MQMessage();
msgPut.messageType = MQC.MQMT_DATAGRAM;
msgPut.format = MQC.MQFMT_STRING;
msgDef.messageId = msgPut.messageId;
msgDef.correlationId = msgPut.correlationId;
msgPut.writeString(pstrQry);
putOptions.options = MQC.MQPMO_NEW_MSG_ID | MQC.MQPMO_NEW_CORREL_ID | MQC.MQPMO_FAIL_IF_QUIESCING;
qEnvio.put(msgPut, putOptions);
}
//Get message on queue2
private String getMessage(){
MQGetMessageOptions getMsgOpt = new MQGetMessageOptions();
getMsgOpt.options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING;
getMsgOpt.waitInterval = 15000;
getMsgOpt.matchOptions = MQC.MQMO_MATCH_MSG_ID | MQC.MQMO_MATCH_CORREL_ID;
MQMessage msgFromQueue = new MQMessage();
msgFromQueue.messageId = msgDef.messageId;
msgFromQueue.correlationId = msgDef.correlationId;
qRespuesta.get(msgFromQueue, getMsgOpt);
strRespuesta = msgFromQueue.readString(msgFromQueue.getMessageLength());
}
}
//Note i always store the MessageID and CorrelationID using a Message Descriptor using code...
private MQMD msgDef = new MQMD();
What could be the problem??
I have to specify others Put or Get MessageOptions??
I hope you can help me!
I have a problem reading from a queue to get a message with an specific ID. My platform MQSeries5.2.1 using Java.
The issue i want to resolve is: I put a message on a queue1 to query a database, then, a server listening prgm. is reading the queue1, getting the message's text to query a database and return the resultet putting a message on a queue2. So, the client who made the query petition on a queue1, is reading the queue2 to seek for the message that contains the resultet. (In all process, i'm storing the messageId and correlationID trough MQMD Message Descriptor)
The problem is when i look for the message id on a queue2 i always get the first message on the queue
//my client code is pretty much like this....
class myClass{
private MQMD msgDef = new MQMD();
//Put message on queue1
private void putMessage(String pstrQry){
MQMessage msgPut = new MQMessage();
msgPut.messageType = MQC.MQMT_DATAGRAM;
msgPut.format = MQC.MQFMT_STRING;
msgDef.messageId = msgPut.messageId;
msgDef.correlationId = msgPut.correlationId;
msgPut.writeString(pstrQry);
putOptions.options = MQC.MQPMO_NEW_MSG_ID | MQC.MQPMO_NEW_CORREL_ID | MQC.MQPMO_FAIL_IF_QUIESCING;
qEnvio.put(msgPut, putOptions);
}
//Get message on queue2
private String getMessage(){
MQGetMessageOptions getMsgOpt = new MQGetMessageOptions();
getMsgOpt.options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING;
getMsgOpt.waitInterval = 15000;
getMsgOpt.matchOptions = MQC.MQMO_MATCH_MSG_ID | MQC.MQMO_MATCH_CORREL_ID;
MQMessage msgFromQueue = new MQMessage();
msgFromQueue.messageId = msgDef.messageId;
msgFromQueue.correlationId = msgDef.correlationId;
qRespuesta.get(msgFromQueue, getMsgOpt);
strRespuesta = msgFromQueue.readString(msgFromQueue.getMessageLength());
}
}
//Note i always store the MessageID and CorrelationID using a Message Descriptor using code...
private MQMD msgDef = new MQMD();
What could be the problem??
I have to specify others Put or Get MessageOptions??
I hope you can help me!