4
votes

I've got a simple pump set up in camel that consumes from a vendor's rabbitmq server using the following uri:

rabbitmq://host:port/statusExchange?queue=myQueueName&username=un&password=pass&exchangeType=fanout&autoDelete=true&durable=false

(their exchange is setup as autodelete=true, durable=false)

When this is run it creates a new queue (myQueueName) that is also autodelete=true durable=false.

I would like my queue to be autodelete=false as we have some network instability between the vendor system and my system.

However if I change the autodelete arg in the uri I get errors when running the code which boil down to:

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'auto_delete' for exchange 'statusExchange' in vhost '/': received 'false' but current is 'true', class-id=40, method-id=10)

If I go into the administrative tool and create the queue manually, setting autodelete to false. Then set autoDelete=true in the uri I get the following error:

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'auto_delete' for queue 'myQueueName' in vhost '/': received 'true' but current is 'false', class-id=50, method-id=10)

This means that the autoDelete uri parameter applies to both the queue and the exchange, if they aren't in agreement you seem to be boned. I can't find anything in the rabbit documentation that suggests that this configuration is in error, and the administration tools let me set up this configuration without issue.

However in the docs found on http://camel.apache.org/rabbitmq.html there is reference to exchangeArgsConfigurer and queueArgsConfigurer, this sounds very promising. However no documentation around what args can be passed and in what format. And my perusal of the source lead me up a blind alley. ( I'm going to plead general Java ignorance, I dabble here and there when I must but it isn't my language of choice )

So what's a camel drinking at the rabbit oasis to do?

1
I'm also seeing a case where` autodelete=true` in the URI is ineffective. Further, removing it entirely doesn't help as when I let Camel create the exchange, it is still made as autodelete=false, even though the default is true.Tony Ennis

1 Answers

3
votes

I had some similar issue in past and the only solution I found is to declare the queue on consumer side equals (identical) to the one generated by the producer, take a look to this:

Amqp client not connecting to activemq server.