|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Not retrieving the proper messageId |
« View previous topic :: View next topic » |
Author |
Message
|
TheDude |
Posted: Mon Aug 18, 2003 1:48 pm Post subject: Not retrieving the proper messageId |
|
|
 Apprentice
Joined: 21 Oct 2002 Posts: 31
|
Howdy,
The following app is using WAS 5.0 & MQ5.3 on RH Linux AS2.1. The application is currently using Java classes not JMS. I have searched the redbooks and this site for a possible resolution to this issue.
The app is a simple Request/Reply. The messageId of the sender message object is assigned to correlId of the receiver message object. I use the System object to display that this is infact happening. I also display the receiver message object messageId and correlId after the reply message has been received and the values that are displayed are completely different. Does the correlId get changed after issuing an MQGet call ?
Here is a snippet of my code:
MQPutMessageOptions pmo = new MQPutMessageOptions();
MQGetMessageOptions gmo = new MQGetMessageOptions();
int openOutPutOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
int openInPutOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
//MQ Environment setup variables
pmo.options = pmo.options + MQC.MQPMO_NEW_MSG_ID;
gmo.options = gmo.options + MQC.MQGMO_WAIT;
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
gmo.waitInterval = 5000;
try {
qMgr = new MQQueueManager(mqValueBean.getQueueManager());
MQQueue targetQueue = qMgr.accessQueue(mqValueBean.getLocalQueue(),mqValueBean.getOutputOptions());
//Put the message on the Queue
targetQueue.put(sendMsgDAO, pmo);
CASLoggers.traceLogger().text(IRecordType.TYPE_INFO, auditClass, auditMethod, "Send: ");
CASLoggers.auditLogger().text(IRecordType.TYPE_ERROR, auditClass, auditMethod, "Sendr" + recvMsgDAO.correlationId);
targetQueue.close();
MQQueue responseData = qMgr.accessQueue(mqValueBean.getReplyQueue(),mqValueBean.getInputOptions());
recvMsgDAO.correlationId = sendMsgDAO.messageId;
System.out.println(sendMsgDAO.messageId);
System.out.println(recvMsgDAO.correlationId);
responseData.get(recvMsgDAO, gmo);
responseData.close();
recvMessageSize = recvMsgDAO.getTotalMessageLength();
qMgr.disconnect();
System.out.println(recvMsgDAO.messageId);
System.out.println(recvMsgDAO.correlationId);
// Extract the message data
String replyMsgData = new String(recvMsgDAO.readString(recvMessageSize));
If I have 3 messages on the queue and I submit a request, the reply message that is retrieved is the next in line in the queue, not the response to my initial request. |
|
Back to top |
|
 |
clindsey |
Posted: Tue Aug 19, 2003 9:54 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
You cannot do a println on the correlid and messageid because they are bytes of binary data. Here is a method you can pull into your code to see the IDs:
Code: |
static void dumpHexId(byte[] myId) {
System.out.print("X'");
for (int i=0; i < myId.length; i++) {
char b = (char)(myId[i] & 0xFF);
if (b < 0x10) {
System.out.print("0");
}
System.out.print((String)(Integer.toHexString(b)).toUpperCase());
}
System.out.println("'");
}
|
Is the server side program yours also? Can you confirm that it moves the incoming messageid to the reply correlid? You might try commenting out your receive of the reply message and dump the reply messages with amsbcg to see if you are getting back a good correlid.
Charlie[/code] |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|