[rabbitmq-discuss] txAMQP and multiple queues per channel

David Sackett rabbitmq-discuss at davidsackett.com
Tue Oct 21 02:15:26 BST 2008


Hi,

I have been testing out txAMQP with RabbitMQ and managed to get
txamqp_example.py<http://www.nabble.com/attachment/19436045/0/txamqp_example.py>working
(after reading posts on this list). I have also tested out amqplib
but see Twisted as a better option for my application.

I'm having difficulty understanding how the channel callbacks should be used
in regard to consuming from queues. amqplib allows callbacks to be attached
to individual queues but it appears that txAMQP only allows callbacks to be
attached to a channel:

amqplib:
channel.basic_consume(queue=queue_name, callback=callback)

txAMQP:
channel.basic_consume(queue=queue_name)
channel.deferred.addCallback(gotMessage)

Also, if I try to attach multiple callbacks or connect a channel to multiple
queues (using basic_consume) strange things happen. Sometimes the callback
is never called and other times channel.queue_declare() returns an object
with a "fields" attribute set to an empty tuple rather than a triplet
containing the queue name. I can't help but feel my problems stem from
incorrectly using the library and not allowing for the asynchronous nature
of Twisted (I am fairly new to Twisted).

What is the correct way to consume from multiple queues with txAMPQ? Should
each channel only consume from one queue? How can I safely initialise all my
channels and queues and latter consume from other queues once in operation?

I haven't included my code because it is convoluted and messy but if needed
I can cut it down and provide it.

Thanks in advance,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20081021/96f8a829/attachment.htm 


More information about the rabbitmq-discuss mailing list