I have a project where I set a timeout of 5 seconds (getRabbitTemplate (). SetReplyTimeout (5000))
and I use the sendAndReceive method to send the messages:getXbidRabbitTemplate ()
SendAndReceive (exchange, routingkey, msg)
.
Today there was an error in the connection
(ShutdownSignalException)
but there has not been a TimeOut in two shipments. The first shipment occurred at 09-04-2019 07: 25: 33.980; and the second at 09-04-2019 07: 25: 36.902;
I have not received an answer (or any error) and shortly after the connection error has jumped (at 09-04-2019 07: 25: 52.939)
Other times, we have detected a TimeOut error, and the only configuration change is that we have removed the retryTemplate from the RabbitTemplate configuration.
This is how we detect the TimeOut:
getRabbitTemplate().setReplyTimeout(5000);
mResponse = getRabbitTemplate().sendAndReceive(exchange, routingkey, msg);
if(mResponse == null)
{
// TIMEOUT
}
I expected that if no answer is obtained in those 5 seconds, I would enter the TIMEOUT part. Is it possible that if the connection is dropped and the message does not reach the server, that TIMEOUT will not occur?
The timeout has nothing to do with any rabbit communication, the calling thread simply calls get(timeout, TimeUnitMilliseconds)
on a future. When the reply is receieved (on another thread), it completes the future and the get()
returns that result. If no reply is received, the get()
times out.
I don't see any way that the thread can never time out.