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 Installation/Configuration Support » Problem with CorrelationId

Post new topic  Reply to topic
 Problem with CorrelationId « View previous topic :: View next topic » 
Author Message
Praveen
PostPosted: Tue Feb 11, 2003 10:59 am    Post subject: Problem with CorrelationId Reply with quote

Apprentice

Joined: 23 Oct 2002
Posts: 40
Location: Bangalore

Hi All
Following is my code.


Code:
 
import com.ibm.mq.*;

public class SendAndRecieve{

   private String qManager ="QM";

   private MQQueueManager qMgr;

//   MQMD md;

   

/**

 * SendAndRecieve constructor comment.

 */

public SendAndRecieve() {

   try{

         

   boolean responseRequired = true;

String totalMessage = transReqResize + clntNameResize + transIdResize + termIdResize + msgTypeResize + msgLengthResize + mcnResize + soResize + bgResize + billerIdResize +
                     aaaConstResize + custTypeResize + arrearsIndResize + cktBilledIndResize + vtnsIndResize + cb01IndResize + cashCardReqIndResize + billPrtSupIndResize
                     + creditClassResize + orgCodeResize + iiCodeResize + isCodeResize + billCycleResize + billingName1Resize + billingName2Resize +
                     billingAddress1Resize + billingAddress2Resize + billingAddress3Resize + domesticFlagResize + billingCityResize + billingStateAbbrResize + zipCodePrefixResize
                     + zipCodeSuffixResize + tyaResize + waiveUccIndResize;

   
   System.out.println("totalMessage" + totalMessage + "the length is " + totalMessage.length());

   sbStr.append(totalMessage);
   
   System.out.println("Message String is .. " + sbStr.toString() + "the length is " + sbStr.length());


   qMgr =new MQQueueManager(qManager);



   int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_IDENTITY_CONTEXT;

   MQQueue system_default_local_queue = qMgr.accessQueue("Send", openOptions, null, null, "praveen");



      MQMessage inMsg =new MQMessage();


      inMsg.format = MQC.MQFMT_STRING;

      inMsg.clearMessage();

      inMsg.messageId = MQC.MQCI_NONE;
      
      inMsg.correlationId = MQC.MQCI_NONE;

      inMsg.messageType = MQC.MQMT_REQUEST;

      inMsg.report = MQC.MQRO_PASS_MSG_ID + MQC.MQRO_PASS_CORREL_ID;

      if(responseRequired){
      inMsg.replyToQueueManagerName = qManager;
      inMsg.replyToQueueName = "Reply";

}
         

         System.out.println("The message is " + sbStr.toString());

         inMsg.writeString(sbStr.toString());




         MQPutMessageOptions pmo =new MQPutMessageOptions();


//         pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT;

         system_default_local_queue.put(inMsg, pmo);
         System.out.println("Message put on queue");


         system_default_local_queue.close();

            

         // Put the message for 10 seconds.View the message on the queue.         

      //   Thread.sleep(100);

         

         MQQueueManager replyQM = new MQQueueManager(qManager);
         int replyOpenOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE;
           MQQueue replyQueue = replyQM.accessQueue("Reply",replyOpenOptions, null, null, null);

           

         MQMessage currentMessage = new MQMessage();

         currentMessage.messageId = MQC.MQCI_NONE;
         currentMessage.correlationId = MQC.MQCI_NONE;

         currentMessage.format = MQC.MQFMT_STRING;

         currentMessage.encoding = MQC.MQENC_NATIVE;

         MQGetMessageOptions gmo = new MQGetMessageOptions( );
         gmo.options      = MQC.MQGMO_WAIT;
         // gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
         gmo.waitInterval = 10 * 1000;
         replyQueue.get(currentMessage, gmo);
         System.out.println("Message retrieved from the queue");

   //      int DataLength = currentMessage.getDataLength();

   //      String msgText = currentMessage.readString(DataLength);

      
         byte buffer[] = new byte[ currentMessage.getDataLength() ];
         currentMessage.readFully(buffer,0,currentMessage.getDataLength() );
         String msgText = new String(buffer);
         
            System.out.println("The message is:" + msgText);



         // Close the queue.

         replyQueue.close();



         // Disconnect from the queue manager.

         qMgr.disconnect();   

         
         

   } // End of try

         

         catch(MQException ex){
             System.out.println("MQ Error - Reason code :" + ex.reasonCode);
       }
    catch (Exception e){
        System.out.println("Error : " + e);
    }
      
}

/**

 * Insert the method's description here.

 * @param args java.lang.String[]

 */

public static void main(String[] args) {
   new SendAndRecieve();   

}

}


When I run this program every time I am getting the same response from the other application, which I should not get. Here I am setting the correlationId to None while putting the message and while getting it back. But the other application is setting the correlationId depending on my messageId when I put the message. I am getting the message each time same is it because I am setting correlationId to None again without checking with proper one?. Please help me out in this regard. Please tell me how to check properly. Whatever I am doing is right or what?
_________________
Thanks,

Praveen K
Back to top
View user's profile Send private message
cdiegobb
PostPosted: Fri Aug 24, 2007 12:51 pm    Post subject: you can try this Reply with quote

Newbie

Joined: 24 Aug 2007
Posts: 2

Hi i make the same application, maybe if you try with this when you can get the queue:

Code:
responseMesage = new MQMessage();
          responseMesage.CorrelationId = requestMessage.MessageId;
          MQGetMessageOptions gmo = new MQGetMessageOptions();




[/code][/quote]
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 Installation/Configuration Support » Problem with CorrelationId
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.