2.12. The Request / Response Pattern

Request / Response applications use the reply-to property,
described in Table 2.9, “Mapping to AMQP 0-10 Message Properties”, to allow a server
to respond to the client that sent a message. A server sets up a
service queue, with a name known to clients. A client creates a
private queue for the server's response, creates a message for a
request, sets the request's reply-to property to the address of
the client's response queue, and sends the request to the
service queue. The server sends the response to the address
specified in the request's reply-to property.

Example 2.18. Request / Response Applications in C++

This example shows the C++ code for a client and server
that use the request / response pattern.

The server creates a service queue and waits for a
message to arrive. If it receives a message, it sends a
message back to the sender.

The client creates a sender for the service queue, and
also creates a response queue that is deleted when the
client closes the receiver for the response queue. In the C++
client, if the address starts with the character
#, it is given a unique name.