1

I have a requirement where I have to copy value of MessageID, correlationID, persistence, Expiry and Priority from request MQ message to response. I put the request message in the queue using RFHUtil . but as the message is consumed by the Session beans the messageID of MQMD header changes to some different value -HEXADECIMAL, which is different from the MessageID I put in RFHUTIL.

then I copy the above values from request to response message using set methods,- setJMSMessageID etc. but the values are different once I view the response message. is this due to MQ to JMS conversion? what can be the solution to this.

Earlier I was using MQ Message and was able to copy all fields from request to response.

JoshMc
  • 10,239
  • 2
  • 19
  • 38

1 Answers1

1

MessageID in IBM MQ is always hexadecimal, no matter from which API it is set, Base MQ or MQ JMS.

You don't need to set the MessageID while sending the request message. Let MQ do that for you. MQ will generate a unique message id for the request message. In your session beans, you simply copy the MessageID of the request message to CorrelationID of response message. This way you can correlate request and response messages.

See IBM WebSphere MQ request/reply scenario for more details.

UPDATE

Any value set using setMessageID method is ignored when the message is sent, but the method can be used to change the value in a received message.

As the message ID set by setMessageID method is ignored when a message is sent, an application cannot specify the message ID of an outgoing message. As a consequence, an application cannot receive a message and then forward the same message, or send a different message, with the same message ID as that of the message it has received. See the link:

Community
  • 1
  • 1
Shashi
  • 14,980
  • 2
  • 33
  • 52
  • Thank you shashi, But the requirement is to send mesaage ID as it is in response message without any change. Is there any way to copy it? Correlation id is to be copied in correlation id of response, not in message ID. – Da-Explorer Oct 01 '16 at 15:25
  • I was able to do it using base MQ, but due to project rerequirements, have to shift to jms and it is creating the problem. Even the value of persistence, expiry and priority is getting changed in response. – Da-Explorer Oct 01 '16 at 15:26