kombu/examples/hello_consumer.py

11 lines
321 B
Python
Raw Normal View History

from __future__ import annotations
from kombu import Connection
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()