File: hello_consumer.py

package info (click to toggle)
kombu 5.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,968 kB
  • sloc: python: 28,815; makefile: 318
file content (10 lines) | stat: -rw-r--r-- 321 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
from __future__ import annotations

from kombu import Connection

with Connection('amqp://guest:guest@localhost:5672//') as conn:
    simple_queue = conn.SimpleQueue('simple_queue')
    message = simple_queue.get(block=True, timeout=1)
    print(f'Received: {message.payload}')
    message.ack()
    simple_queue.close()