Return Address

The Correlation Identifier is the fundamental pattern for creating a request/reply communication on top of a one-way channel. However, it’s not enough when our messaging architecture has more than one channel or queue, or when there can be potentially more than one requestor. In these situations, in addition to a correlation ID, we also need to know the return address, a piece of information that allows the replier to send the response back to the original sender of the request.

Implementing the Return Address pattern in AMQP

In the context of an AMQP-based architecture, the return address is the queue where the requestor is listening for incoming replies. Because the response is meant to be received by only one requestor, it’s important that the queue is private and not shared across different consumers. From these properties, we can infer that we’re going to need a transient queue scoped to the connection of the requestor and that the replier has to establish a point-to-point communication with the return queue to be able to deliver its responses.

The following illustration gives us an example of this scenario.

Get hands-on with 1200+ tech skills courses.