Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
pp-python-commons / rabbit_create_queue_script.py
Size: Mime:
import pika

host = ""
user = ""
password = ""
exchange = ""
queue = ""
queue_dlq = ""

credentials = pika.PlainCredentials(user, password)
connection = pika.BlockingConnection(
    pika.ConnectionParameters(
        host,
        virtual_host="/",
        heartbeat=600,
        blocked_connection_timeout=300,
        credentials=credentials,
    )
)
channel = connection.channel()
channel.exchange_declare(exchange=exchange, exchange_type="fanout", durable=True)
channel.queue_declare(queue=queue_dlq, durable=True, arguments={"x-queue-type": "classic"})
channel.queue_declare(
    queue=queue,
    durable=True,
    arguments={
        "x-queue-type": "classic",
        "x-dead-letter-exchange": "",
        "x-dead-letter-routing-key": queue_dlq,
    },
)
channel.queue_bind(exchange=exchange, queue=queue)