Here is a minimal example:
package main
import (
"fmt"
"github.com/streadway/amqp"
)
func main() {
conn, _ := amqp.Dial("amqp://guest:guest@localhost/")
defer conn.Close()
ch, _ := conn.Channel()
defer ch.Close()
q1, err := ch.QueueDeclare("test_qqq", /* durable: */ true, false, /* exclusive: */ false, false, nil)
handle(err)
fmt.Println("%+v", q1)
q2, err := ch.QueueDeclare("test_qqq", /* durable: */ true, false, /* exclusive: */ true, false, nil)
handle(err)
fmt.Println("%+v", q2)
}
func handle(err error) {
if err != nil {
panic(fmt.Sprintf("%v", err))
}
}
Using:
As you can see, in this example I am trying to recreate same queue twice, first with exclusive:true, then with exclusive:false. It fails as expected, but produces unexpected error message:
Exception (406) Reason: "PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'test_qqq' in vhost '/': received 'false' but current is 'true'"
I spent half an hour looking blankly at my durable: true statement, but actually should be looking into exclusive argument. Is there a way to keep future users from such a loss of time? It should be like args 'durable' and 'exclusive' are in conflict with each other. Or is it RabbitMQ problem?
See Declaration property equivalence in the Queues guide.
See Declaration property equivalence in the Queues guide.
I understand you may get tens complains like this every week, but i can assure you I've read the docs. The problem not in an error itself or its code, but in error message, which is misleading. It says I must set durable to true, which I already did. Or maybe you are saying that it is a RabbitMQ fault, not your package's, and I should file an issue in their repo?
Update: I've checked the package's source and can see now it's a problem on a RabbitMQ side, sorry. Case closed here.
@SergeAx - https://github.com/rabbitmq/rabbitmq-server/issues/1887
Basically, the presence of "exclusive" negates the durable argument, but durable is checked first. I'm fixing it now. Thanks for the code to reproduce the issue.
@SergeAx apologies, I didn't spot the combination of properties you were using. Indeed most such questions come from complete beginners so I used a canned response.
Most helpful comment
@SergeAx - https://github.com/rabbitmq/rabbitmq-server/issues/1887
Basically, the presence of "exclusive" negates the durable argument, but durable is checked first. I'm fixing it now. Thanks for the code to reproduce the issue.