[Python] Rabbitmq with python error

Discussão em 'Python' iniciado por Stack, Janeiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have installed pip install pika==0.11.0, as it is shown on the readme file, and after that I tried python receiver.py, and it gave me the following error:

    Traceback (most recent call last):
    File "receive.py", line 9, in <module>
    channel.queue_declare(queue='hello')
    File "C:\Python36\lib\site-packages\pika\adapters\blocking_connection.py", line 2400, in queue_declare
    self._flush_output(declare_ok_result.is_ready)
    File "C:\Python36\lib\site-packages\pika\adapters\blocking_connection.py", line 1258, in _flush_output
    raise exceptions.ChannelClosed(method.reply_code, method.reply_text)
    pika.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'hello' in vhost '/': received 'false' but current is 'true'")


    Even if I didn't modify anything. I tried also the spring-amqp example, and these works. Can you gave me a hint about what should I change?

    These is the py fille:

    import pika

    connection = pika.BlockingConnection(pika.ConnectionParameters(
    host='localhost'))
    channel = connection.channel()


    channel.queue_declare(queue='hello')

    def callback(ch, method, properties, body):
    print(" [x] Received %r" % body)

    channel.basic_consume(callback,
    queue='hello',
    no_ack=True)

    print(' [*] Waiting for messages. To exit press CTRL+C')
    channel.start_consuming()


    The error is at thee following line:

    channel.queue_declare(queue='hello')

    Continue reading...

Compartilhe esta Página