Direct reply on the default exchange (amq.default)

This method seems to deviate from RabbitMQ’s proposed method using the amq.rabbitmq.reply-to. It also seems to work.

SERVER: declares a named queue SERVER_QUEUE.
      : begins consuming from SERVER_QUEUE.
CLIENT: declares a nameless queue CLIENT_QUEUE.
BROKER: generates a name for CLIENT_QUEUE.
CLIENT: begins consuming from CLIENT_QUEUE.
      : publishes to the routing_key SERVER_QUEUE a message MESSAGE
        with .reply_to set to CLIENT_QUEUE and a unique (or
        monotonic) .correlation_id.
SERVER: consumes MESSAGE from SERVER_QUEUE.
      : sends a reply REPLY to CLIENT_QUEUE named in
        MESSAGE.reply_to with the .correlation_id given in
        MESSAGE.correlation_id.
BROKER: routes REPLY to CLIENT_QUEUE.
CLIENT: consumes REPLY from CLIENT_QUEUE.

All RPC takes place on amq.default: requests to named queues; responses to broker-named queues.

Routing on a topic exchange: e.g., amq.topic

ANY   : declares a nameless queue QUEUE.
BROKER: generates a name for QUEUE.
ANY   : begins consuming from QUEUE.
      : subscribes (or binds) topics (or routing keys) to QUEUE.
      : sends messages to topics.
BROKER: routes to QUEUE messages matching one or more of the topics
        to which it has subscribed.
ANY   : consumes messages from QUEUE.
      : sends replies to topics.

RPC is a function of programs’ state rather than of messages’ routing: requests and replies are indistinguishable at the AMQP and RabbitMQ levels. Requests must contain instructions or hints for how programs are to address their replies.