File: declare_queue.py

package info (click to toggle)
celery 5.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,188 kB
  • sloc: python: 64,417; sh: 795; makefile: 378
file content (15 lines) | stat: -rwxr-xr-x 389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Create a quorum queue using Kombu."""

from kombu import Connection, Exchange, Queue

my_quorum_queue = Queue(
    "my-quorum-queue",
    Exchange("default"),
    routing_key="default",
    queue_arguments={"x-queue-type": "quorum"},
)

with Connection("amqp://guest@localhost//") as conn:
    channel = conn.channel()
    my_quorum_queue.maybe_bind(conn)
    my_quorum_queue.declare()