RPC tutorial questions regarding the queue and channel #12193
-
I went through the RPC tutorial on the RabbitMQ website and have some questions. Why does the client code (see below) not define the queue name? For example, instead of using result = channel.queue_declare(queue='', exclusive=True)
callback_queue = result.method.queue In the server portion of the code (see below), which channel def on_request(ch, method, props, body):
... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@wigging you can use an client-provided queue name but since that is a response queue, that won't work very well once you have N clients. Therefore server-named queues are used for response (request-reply client-owned) in the tutorial. This is different from request-reply server queues which can and usually are explicitly named and "well-known" in the overall system. N competing consumers (server instances) on such queues pose no problem and create no confusion. The channel used in Pika's callbacks is the channel the delivery arrived on, which is the channel you have registered the consumer on. |
Beta Was this translation helpful? Give feedback.
@wigging you can use an client-provided queue name but since that is a response queue, that won't work very well once you have N clients. Therefore server-named queues are used for response (request-reply client-owned) in the tutorial.
This is different from request-reply server queues which can and usually are explicitly named and "well-known" in the overall system. N competing consumers (server instances) on such queues pose no problem and create no confusion.
The channel used in Pika's callbacks is the channel the delivery arrived on, which is the channel you have registered the consumer on.