txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00036
How do you listen to different queues asynchronously?
Hi all,
It's me again.
I've been trying to get a consumer to listen to two channels using
LoopingCall: http://dpaste.com/hold/118305/. The code is modified from
the original examples. What I wanted to achieve was to listen to
different queues asynchronously (on one channel each queue). The code
which I sent both queues are on the same exchange.
A snip:
@inlineCallbacks
def do(queue, chan):
msg = yield queue.get()
print 'Result: %s from chan id #%d' % (msg.content.body, chan.id)
lcall = task.LoopingCall(do, queue, chan)
lcall2 = task.LoopingCall(do, queue2, chan2)
lcall.start(0)
lcall2.start(0)
The concrete problem I've is that I use one channel for a fanout
exchange to broadcast messages and another for a point-to-point
communication and I would like to listen to both and operate
accordingly.
Is this ok? Is there a better way? Should I use threads here?
Another question I've is what about terminating the connection:
How should I end the connection without sending the STOP message?
Thank you,
--
Ale.
Follow ups