Spring with AMQP and RabbitMQ, queue with optional x-dead-letter-exchange

As you can see in the spring docs: The RabbitMQ broker will not allow declaration of a queue with mismatched arguments., so you can't do it.
In the RabbitMQ Java API there is a method to check whether a queue already exists: queueDeclarePassive.

If the Spring AMQP API provides a similar functionality you can use it before trying to declare the queue.


Yes, The possible cause is - if you declare some queues manually and later your program (client in code) tries to create one (based on the settings you had in code) then you get this error. The reason behind it is when your code (client application) tries to access one queue. It gets a signal from the server that the connection is not available for this.

To solve this problem

  • Delete all the queues that you have created manually, and let the client program create them by itself.
  • If you got problems in deleting the queues, because of some data is there in it, or for some reason, you want to maintain it, create one queue manually, and move all the queue data to be deleted in it through "Move" tab of the queue.