corvus-ch / rabbitmq-cli-consumer

Consume RabbitMQ messages into any cli program
MIT License
236 stars 36 forks source link

Improve error message when failing to create a queue due to setting mismatch #45

Closed a-ast closed 5 years ago

a-ast commented 5 years ago

I'm trying to run rabbitmq-cli-consumer from a docker container (image: 'thecodingmachine/php:7.2-v1-cli'):

rabbitmq-cli-consumer is taken as a binary from rabbitmq-cli-consumer_2.3.0_linux_386.tar.gz

When I run: ./rabbitmq-cli-consumer --verbose --url amqp://guest:guest@rabbitmq --queue-name hello --executable worker.php

this error message appears:


2018/10/18 23:31:56 failed to register a consumer: Exception (504) Reason: "channel/connection is not open"
maximium commented 5 years ago

So can your connect to rabbitmq from the container with telnet?

a-ast commented 5 years ago

@maximium I've managed to run the consumer script. I've figured out that it always fails to listen for queues created as non-durable.

I'm yet very familiar with rabbitmq yet, so I don't how critical it is. If you think that it is a normal behaviour, let's close my issue.

corvus-ch commented 5 years ago

By default, the consumer tries to create the queue. If the queue is already defined with different settings, this will fail. Since the consumer tries to create a durable queue and the existing queue was created as transient, this fails.

For this cases, the option --no-declare can be set to prevent the consumer from creating one.

Whats certainly bad here is the error message which by now way indicates what the actual issue is. This certainly needs to be improved.