examples/quorum-queues/declare_queue.py
raw| 1 | """Create a quorum queue using Kombu.""" |
| 2 | |
| 3 | from kombu import Connection, Exchange, Queue |
| 4 | |
| 5 | my_quorum_queue = Queue( |
| 6 | "my-quorum-queue", |
| 7 | Exchange("default"), |
| 8 | routing_key="default", |
| 9 | queue_arguments={"x-queue-type": "quorum"}, |
| 10 | ) |
| 11 | |
| 12 | with Connection("amqp://guest@localhost//") as conn: |
| 13 | channel = conn.channel() |
| 14 | my_quorum_queue.maybe_bind(conn) |
| 15 | my_quorum_queue.declare() |