Hi,
I have a Queue bean (@Bean) defined in configuration (@Configuration) class like:
If the Rabbit AMQP broker is down (i.e. service is down for some reason) I am getting java.net.ConnectException on application startup:Code:@Bean public Queue testQueue() { return messagingAdmin().declareQueue(); }
What I want is to let Spring AMQP/RabbitMQ throw the exception in logs and let the application server continue to be run. How can I achieve this?Code:Caused by: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect at org.springframework.amqp.rabbit.connection.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:106) at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:163) at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:228) at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:77) at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:121) at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67) at org.springframework.amqp.rabbit.connection.RabbitAccessor.getTransactionalResourceHolder(RabbitAccessor.java:100) at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:591) at org.springframework.amqp.rabbit.core.RabbitAdmin.declareQueue(RabbitAdmin.java:129)
Thanks


Reply With Quote