我正在为rabbtMQ做一个消费者。我正在使用python,经过研究,我决定使用Kombu。有了Kombu,我已经连接到rabbit中的一个队列并阅读消息。代码是
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()
这似乎有效,但我经常看到芹菜和贡布一起使用。我只需要使用队列中的消息,Kombu是否足够,或者我是否也应该集成芹菜。如果是的话,有没有人有一个好的例子,我找到了一些例子,但我不清楚。 另外,我想使我的队列持久=假,但消费者似乎有持久=真的默认值。我怎样才能改变这个?你知道吗
谢谢你的帮助!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐