pika.exceptions.channelclosedbybroker: (406, "precondition_failed - inequivalent arg 'durable' for queue 'fx-naas' in vhost 'fx': r code example

Example: pika.exceptions.channelclosedbybroker: (406, "precondition_failed - inequivalent arg 'durable' for queue 'fx-naas' in vhost 'fx': r

# This script will publish MQ message to my_exchange MQ exchange

import pika
#credentials = pika.PlainCredentials('the_user', 'the_pass')
#connection = #pika.BlockingConnection(pika.ConnectionParameters('localhost', 5672, '/', pika.PlainCredentials('guest', 'guest')))
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost', 5672, 'test', pika.PlainCredentials('admin', 'password1243')))
channel = connection.channel()

#channel.queue_declare(queue='items-queue', durable=Ture)
channel.queue_declare(queue='dx-naas', durable=True)


channel.basic_publish(exchange='my-exchange', routing_key='my-routing-key', body='Hello World!')

print("[x] Sent 'Hello World!'")

connection.close()

Tags:

Misc Example