Axon - amqp rabbit exclusive consumer error



  • We have 2 queues with exclusive consumers updating 2 different data sources (read / write)
  • There is a single axon-cluster which we point to Queue1 / Queue2 on certain events
  • This is done by calling shutdown() on one queue and start on other queue.
  • At any point only one consumer is attached to one of the Queues
  • We are seeing random errors as below complaining on the exclusive issue when starting Queue2 (or 1), which implies the shutdown on the previous iteration for that queue didnt fully complete. We see this a lot when we reduce the defaultShutdownTimeout from 5 sec to lesser (~1sec) , but in some scenarios even with 5 sec.
  • Any way to avoid this? Or something wrong in our usage of Cluster / Shutdown / Start containers?

This is happening when the shutdown & start of container is called too soon (shutdownTimeout<5 sec) as the asyncShutdown is taking longer to fully detach from the consumer. Temporary workaround we’re following is to remove the exclusivity of the queue.


this exception simply means that the connection to a queue is refused, because another listener is already connected to it. If you swap queues/clients quickly, it might be an indication that the client wasn’t fully disconnected yet, before another attempted to connect.