Reputation: 4851
It is generally discouraged to use the message id returned from the JMS provider as the correlation id with which a message is published onto a queue. How have people generated their correlation ids for a request/response architecture?
Upvotes: 13
Views: 28858
Reputation: 648
Server-side correlation ID generation suffers from two problems though:
One-way protocols (like JMS) have no direct means of returning the correlation ID back to the client. Another channel could be used but that complicates things.
Unexpected issues can prevent the client from receiving the generated ID even though the request has been accepted and processed on the server. This is why client ID generation should be considered.
Client generated correlation IDs
Clients can use a unique ID standard like UUID to generate a new ID
message.setJMSCorrelationID(UUID.randomUUID().toString());
Ref: http://blogs.mulesoft.com/dev/anypoint-platform-dev/total-traceability/
Upvotes: 2
Reputation: 5905
Clients can use a unique ID standard like UUID
to generate a new ID.
Here is good tutorial for you.
You can return correlation id from JMS provider using following code.
message.setJMSCorrelationID(UUID.randomUUID().toString());
producer.send(message);
LOG.info("jms-client sent:" + message.getJMSCorrelationID());
Cheers.
Upvotes: 2