Using ReplyTo

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using ReplyTo

Jon Brisbin-2
Maybe I'm not approaching this correctly. I was wondering how the ReplyTo property is meant to be used by the consumer that is supposed to reply to requests. I'd prefer not to have to assume an exchange, so I've been trying to figure out the best way to send responses back to clients.

I pushed some code to GitHub for a JMX MBean invoker that uses RabbitMQ and in the consumer that does the invoking, I take the ReplyTo property and split it on a comma (I've also experimented with a colon and other characters).

I just don't like the feel of this, though. Maybe it's okay, but I worry that having to rely on splitting the replyTo to get my exchange and routingKey values might break something. Maybe I should use a header value or even code the response exchange and queue into the body of the request?

I'd like to hear how others are using the replyTo in responding to requests...

Jon Brisbin
Portal Webmaster
NPC International, Inc.




_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Using ReplyTo

Matthias Radestock-3
Jon,

Jon Brisbin wrote:
> Maybe I'm not approaching this correctly. I was wondering how the
> ReplyTo property is meant to be used by the consumer that is supposed
> to reply to requests. I'd prefer not to have to assume an exchange,
> so I've been trying to figure out the best way to send responses back
> to clients.

Typically the replyTo field contains the name of the reply queue. And
you use that as the routing key of the reply message and send that
message to the default exchange.

The default exchange mainly exists for this and similar use cases. You
can think of it as providing a convenient mechanism for addressing
queues directly, i.e. any message sent to the default exchange is routed
to the queue named in the routing key.

Regards,

Matthias.

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Using ReplyTo

Tony Garnock-Jones-2
Matthias Radestock wrote:
> Typically the replyTo field contains the name of the reply queue. And
> you use that as the routing key of the reply message and send that
> message to the default exchange.

To clarify, "default exchange" is AMQP jargon for the exchange with the
empty-string as its name.

  channel.basic_publish(exchange = "", routing_key = queue_name, ...)

The spec mandates that this exchange route directly to queues named the same as
the routing keys used. Whenever a queue is created, a binding for the queue is
automatically created on the default exchange.

Regards,
  Tony

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss