0

When I run the standalone IBM MQ JMS client to send and receive the message. I got the below reply message and the correlationID.

The message I send to the Queue:

    REQUEST(SER,10,TEST,MSGID,20 ..
    I got the Reply message as below:
    REPLY(MSGID,20,DTO0240,SER,10,TEST

  correalationID
  after sending a message we get message id 
 ID:414d51204243573032413154202020205bc6bd3e254d4820

I need to store the Message ID and the reply message in the Data base but My doubt is how to get the Matching (MSG ID 20) from the reply message to store in the database . Is it possible to get from the reply message. I got confusion.

         When I store in the DB do I store only the correalation ID 
         (ID:414d51204243573032413154202020205bc6bd3e254d4820) only possible. 
    MY DB has column:

    MessageID  requestMessage replymessage and Flag. Based on Flag "N"

I will read and send to the Queue and once I got reply i need to update back the reply message based on MessageID. so Is it possible to get the Message ID from the reply message. Sorry for my way of asking questions. Thanks in Advance

Maxtech
  • 111
  • 16
  • Does the MessageID column in the DB represent the Message ID of the original Request message? Does the app that replies copy the MessageID of the request into the correlationID of the Reply? the answer to both is YES then you would want to inquire the Correlation ID of the Reply to match it against your DB. – JoshMc Feb 11 '19 at 11:00
  • This one may also help: https://stackoverflow.com/questions/23342116/ibm-websphere-mq-request-reply-scenario/23359217 – Shashi Feb 11 '19 at 11:03
  • The other thought is that you are not talking about the MQMD MessageId at all and in the above description MSGID is some field that you put in the message body of the request message and receive back as part of the message body of the response. It is not clear to me either way. – JoshMc Feb 11 '19 at 11:15
  • @JoshMc For the First Question I will check and For the second question The other app receive as qsession.createReceiver(queue, String.format("JMSCorrelationID='%s'", msgid)); and they uses reply queue when sending requests to other apps also, it will set the JMSCorrelationID equal to the JMSMessageID when I tested I got msg header details as below MSMessageID: ID:414d51204d434c3032413154202020205bddb51521db0c29 JMSCorrelationID: ID:414d51204243573032413154202020205bc6bd3e254d4820 so in that case do I need to set any thing setJMSCorrelationID() on the sent message – Maxtech Feb 11 '19 at 13:10
  • @JoshMc why I am getting Message ID and Correlation ID different – Maxtech Feb 11 '19 at 13:15
  • @JoshMc Yes there is a MSDID field there are sending and receiving to co orodinate the message My doubt is it possible to get the MSDID field from the reply message if yes how to do please – Maxtech Feb 11 '19 at 13:22
  • You need to know what the app that seems replies is doing. I explained previously that many will copy the msgid to correlid. If that is the case there is no reason for you to set correlid on the message you send. Seems like a waste of time to try and have people on SO try and guess how your app should function. You should ask the app that sends replies how it should work. – JoshMc Feb 11 '19 at 14:27
  • Also it would be normal for the reply message id to be different if the replying app does copy the original request message id to the correlationID – JoshMc Feb 11 '19 at 14:33
  • @JoshMc in the request and reply message Request:REQUEST(SER,6,CREATE,MSGID,15,XD024049364174. Reply (MSGID,15,UXD024049364174... Ser "6" is the service name "CREATE" and MSGID is 15 chars "XD024049364174" so I am looking how to get the Field MSGID "XD024049364174" separately is there any way to get the this field from reply message – Maxtech Feb 11 '19 at 15:01
  • @JoshMC looks like we need to write java code to split the message and get the message ID correct me – Maxtech Feb 11 '19 at 15:11
  • That is right, since the MSGID you are speaking about is actually in the body of the message not in the message header (MQMD) there is not way for you to get it with out parsing the message body. You could discuss with the replying app to see if they would be willing to also send it as a custom message property, this could be viewed or selected on just like any other MQMD field. – JoshMc Feb 11 '19 at 17:01

0 Answers0