Open rogeriobiondi opened 7 years ago
Replying for anyone encountering this issue.
I had the opposite error in Python:
pika.exceptions.ChannelClosed: (406, "PRECONDITION_FAILED - inequivalent arg 'x-max-length' for queue 'test' in vhost '/': received the value '1' of type 'signedint' but current is none")
The problem was that the queue already existed and had been set up without the option set so defaulted to having no maximum queue length. When Rabbit receives the new queue declaration, it sees that it conflicts with existing queue options and prevents the queue changing whilst "in use". There are two solutions: 1) If the queue isn't actually in use, delete it then declare it using the correct options. 2) Ensure any declarations for the queue use the same configuration/options so there's no conflict.
For anyone encountering this, you should go with solution (2) - solution (1) is only for fixing it so you can use solution (2).
@agrski is there any way to update a queue configs such as x-max-length
on the fly without deleting the queue? I'm receiving the same error when trying to add the x-max-length
config to a queue in my python code. A solution through code or rabbit's API or GUI would be welcomed!
So far I've only been able to resolve by deleting the queue which isn't desirable
from your working directory, try:
grep -RIn 'x-max-length' .
Hello,
I'm trying to setup the x-max-length parameter in my queues:
rabbitmqctl set_policy Ten "^one-meg$" '{"x-max-length": 10}' --apply-to queues
But when trying to use rabbit.js I'm getting the following error:
Error: Channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-max-length' for queue 'WORKER' in vhost '/': received none but current is the value '10' of type 'signedint'"
In python (pika) I can set this parameter the following way:
credentials = pika.PlainCredentials('user', 'pw') parameters = pika.ConnectionParameters(host='127.0.0.1', port=5672, virtual_host='/', credentials = credentials, heartbeat_interval = 60) connection = pika.BlockingConnection(parameters) channel = connection.channel() args = { "x-max-length": 10 } channel.queue_declare(queue="WORKER", durable=True, arguments=args)
May you clarify me how this could be accomplished using rabbit.js?
Thank you very much for your help.
Best regards, Rogerio