priya
priya

Reputation: 11

duplicate messages with same JMS correlationID

I have a Application where a message(with specific correlation ID) is placed in a topic with four subscribers.When a message is placed it is consumed by 4 subscribers and they are placing the reply with the same correlation id to a queue(reply=4messages).Now I have a doubt that when messages are having duplicate correlation id. How will the consumer know which message to consume when it is searching for the message with correlation id placed in the request?

Upvotes: 1

Views: 1559

Answers (1)

Matt Pavlovich
Matt Pavlovich

Reputation: 4306

There is no inherent problem with duplicate JMSCorrelationIDs. The consumer interested in the responses generally creates a consumer with a selector (i.e. JMSCorrelationID = 'ID-XXX...'). That consumer will match all messages that contain messages with the specified correlation id.

If you need to process each of the four responses separately, you'll need to define a convention where a custom message property determines which messages is from which original topic subscriber.

Upvotes: 1

Related Questions