I am relying on CloudAMQP service and I need to be able to support messages of size up to 10 Megabytes:
1. Map<String, Object> params = new HashMap<>();
2. params.put("x-ha-policy", "all");
3. params.put("x-max-length-bytes", 10_000_000);
4. channel.queueDeclare(messageQueueName, true, false, false, params);
My problem is that whenever the line 3 is not commented out, the queue throws an exception:
Caused by: com.rabbitmq.client.ShutdownSignalException:
channel error; reason: {#method<channel.close>(reply-code=406,
reply-text=PRECONDITION_FAILED -
inequivalent arg 'x-max-length-bytes' for queue 'someQueueName'
in vhost 'yzscezrk': received none but current is the value '1000000'
of type 'signedint
What am I doing wrong here?
PRECONDITION_FAILED Means that you already have a queue declared and you are trying to create the same queue with different parameters.
The queue already have the parameter x-max-length-bytes and most likely your are trying to change it.
You can remove the queue ( you will loose the messages) and try to create it again with the parameters you need