I have a project in which I use Spring AMQP. I have two SimpleMessageListenerContainer, one with a self-declared queue by the server (amq-gen), and one with a queue with a given name. I use a SimpleRoutingConnectionFactory with two CachingConnectionFactory. For error detection I have a ConnectionListener, ListenerContainerConsumerFailedEvent, and a ConditionalExceptionLogger.
The idea is to switch between two Rabbit servers once an error is detected in the AMQP connection, but when there is an error in the AMQP connection several errors are thrown in the ConditionalExceptionLogger, several events of type ListenerContainerConsumerFailedEvent, and complicates the fact of switching automatically Between servers.
What could be the best way to do that switching automatically given a number of retries?
Thank you