想要成为消费者,不确定kombu是否足够,或者我还需要实施Celery

时间:2015-04-14 16:58:33

标签: python celery kombu

我正在为rabbtMQ做消费者。我正在使用python,经过研究后我决定使用Kombu。使用Kombu我已经连接到兔子队列并阅读消息。代码是

queue = Queue('someQueue')

def process(body, message):
    # Something
    message.ack()

# connections
with Connection(hostname="localhost", userid="****", password="****", port=****, virtualhost="/") as conn:

# consume
with conn.Consumer(queue, callbacks=[process]) as consumer:
    # Process messages and handle events on all channels
    while True:
        conn.drain_events() 

它似乎有用,但我经常看到Celery和Kombu一起使用。我只需要消耗队列中的消息,足够Kombu或者我也应该整合Celery。如果是这样,有没有人有一个很好的例子,我找到了例子,但他们并不清楚。 另外我想让我的队列持久= false但是消费者似乎默认持久= true。我怎么能改变这个?

感谢您的帮助!

0 个答案:

没有答案
相关问题