ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Not retrieving the proper messageId

Post new topic  Reply to topic
 Not retrieving the proper messageId « View previous topic :: View next topic » 
Author Message
TheDude
PostPosted: Mon Aug 18, 2003 1:48 pm    Post subject: Not retrieving the proper messageId Reply with quote

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
View user's profile Send private message
clindsey
PostPosted: Tue Aug 19, 2003 9:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Not retrieving the proper messageId
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.