kombu/examples/hello_consumer.py

10 lines
294 B
Python
Raw Normal View History

from kombu import Connection # noqa
2012-12-11 04:35:02 +00:00
2012-12-11 04:35:02 +00:00
with Connection('amqp://guest:guest@localhost:5672//') as conn:
simple_queue = conn.SimpleQueue('simple_queue')
message = simple_queue.get(block=True, timeout=1)
2020-07-13 13:58:06 +00:00
print(f'Received: {message.payload}')
2012-12-11 04:35:02 +00:00
message.ack()
simple_queue.close()