My application will create a queue which is auto-delete
at startup. The application environment may lose its network and rabbitmq server will delete queue, therefore, after the network is restored, the listener will continue to report errors: the queue cannot be found. How do I detect this and recreate the queue?
How about using cachingConnectionFactory.setCloseExceptionLogger
?
If you add a Queue
@Bean
and a RabbitAdmin
@Bean
, the admin will redeclare the queue each time a connection is opened. It registers itself as a ConnetionListener
with the connection factory.
See the documentation.