[rabbitmq-discuss] FW: RabbitMQ

Feng Tian ftian at vmware.com
Thu Oct 28 19:11:53 BST 2010


Hi, 

I am using pika to write a multi threaded python program.  From what I learned so far, the BlockingConnection is a better fit for my need.   At least for me, seems that the Asyncore is not really designed for multi threaded app.  I modified the test_threads.py so that it sort of "works", except I have the following

            while True:
                ch_a.basic_consume(hdler, queue=q)
                print "Wait for recv ..."
                time.sleep(5)

This have some problems that I cannot figure out how to resolve,
1. No one want to call sleep :-)
2. basic_consume seems to have a round trip talk with server, even though there is nothing to consume.

That is exactly what puzzled me in the first place, if using amqplib, I can do

ch.basic_consume ...
while True:
     ch.wait()

What can I do with pika to get this effect?  And of course,  ch.wait(timeout) would be even better.  Any clue how to do this with pika?

Thanks,
Feng


More information about the rabbitmq-discuss mailing list