How does a requestor that has received a reply know which request this is the reply for?
Each reply message should contain a Correlation Identifier, a unique identifier that indicates which request message this reply is for.
There are six parts to Correlation Identifier:
- Requestor — An application that performs a business task by sending a request and waiting for a reply.
- Replier — Another application that receives the request, fulfills it, then sends the reply. It gets the request ID from the request and stores it as the correlation ID in the reply.
- Request — A Message sent from the requestor to the replier containing a request ID.
- Reply — A Message sent from the replier to the requestor containing a correlation ID.
- Request ID — A token in the request that uniquely identifies the request.
- Correlation ID — A token in the reply that has the same value as the request ID in the request.
... Read the entire pattern in the book Enterprise Integration Patterns