Andrés Fernández Andrés Fernández - 10 months ago 95
Python Question

Consuming from multiple queues at once with aioamqp

Is it possible to consume multiple queues at once using one channel with aioamqp?

Disclaimer: I created an issue in the project issue tracker but I'm really wondering if what I'm doing makes sense at all.


I think that this feature is not available in AMQP protocol (assuming my understanding of the protocol is correct).

If you wish to consume from a queue you have to issue basic.consume call on a channel. The required argument for this call is queue_name and it's a "blocking" (not blocking a connection but blocking a channel) call where response is an object from the queue.

Long story short: each consumer has to have an exclusive access to a channel while it's waiting for queue objects.

OK, so my initial thought was incorrect. After digging into AMQP I found out that it actually does support multiple consumers over one channel. However it does allow servers to set their limits if desired. Unfortunately I couldn't find any info about RabbitMQ specific case. So I assume that there is no such limit. All in all: this is an issue with the library.

However the workaround is still valid: just create a channel per consumer. It should work just fine.