How to set JMSMessageID and JMSCorrelationID correctly?

I made a java application that uses JMS to send messages to the MQ queue. I set the message id and correlation id using setJMSMessageId () and setJMSCorrelationId (). The message seems to be overwritten when sending is complete. I searched Google a bit and it seems like the server is overwriting messageId even when sending it.

The requirement for this application is that both messageId and correId have the same value when sending and when receiving. Can't I do anything about it?

Note. I am using JDK 1.6 and WAS 8.5 to deploy the application. This WAS contacts the MQ queue manager.

+4
source share
3 answers

Message identifiers are reserved for installing the messaging system. You can read it and, for example, a magazine or even save it, but nothing more. Esp., It should not be installed by the application! The installer exists only when it is connected between two messaging systems, that is, when you receive a message from one messaging system X and forward it to another messaging system Y. Then Y should be able to set the message identifier of this message object, even though Y did not create it, i.e. although this is not Y own implementation. There are several methods for this use case, and this causes a lot of confusion; it’s best to ignore them.

OTOH, . -, :

  • A D , D ', A . , A send, A .
  • B , - D '. . , .
  • , A D ', , 1.

, --- , ; - . JavaDoc. . . - .

: , , JMS-API .

+5

setJMSMessageId() setJMSCorrelationId().

, , . MQ. / , .

+2
I set it in the application because MQ needs it

IBM MQ MessageID, MQ MessageID . MessageID ( IBM MQ) (aka request) CorrelationID . , - .

+2

Source: https://habr.com/ru/post/1538109/


All Articles