I am using Spring AMQP libarary (1.1.4.Release) to send messages to a Rabbit MQ Exchange. I am specifically using the RabbitTemplate.correlationconvertAndSend() method. This RabbitTemplate is created using a CachingConnectionFactory
with PublisherConfirms
and PublisherReturns
set to true
.
Recently we had an network issue when both Producer and Consumer had their connections to the RabbitMQ Broker/Exchange closed in the middle of sending a message. This resulted in a org.springframework.amqp.AmqpIOException: java.net.SocketException: Broken pipe
being thrown. However the problem was that this Exception was being thrown after more than 150s. This was causing all the threads to be in Blocked state for extended periods.
Is there any way I can set a timeout so that I can set so that I can get early feedback and take appropriate action. I am thinking more along the lines of a timeout value for an http or db call. RabbitMQ's ConnectionFactory has a connection timeout value http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.0/rabbitmq-java-client-javadoc-3.1.0/com/rabbitmq/client/ConnectionFactory.html#setConnectionTimeout(int)
.