[rabbitmq-discuss] RabbitMQ Cilent: Allow specifying the connect timeout

Emile Joubert emile at rabbitmq.com
Wed Oct 27 12:01:49 BST 2010


Hi Amr,

On 23/10/10 19:20, Amr Mostafa wrote:
> Hi,
> 
> I've been searching around for a way to specify a connect timeout in the
> Java client, but couldn't find an easy way to do that. There is one way,
> which is by extending ConnectionFactory with a custom createFrameHandler
> method, but that doesn't work with my case since I'm using Spring AMQP
> support on top of the client API.
> 
> It would be very useful to add an option for that in the
> ConnectionFactory which, if specified, would be passed to the socket
> connect call.

You can also set socket options by overriding
ConnectionFactory.configureSocket(). By default this hook disables
Nagle's algorithm, but it can be used to set the timeout as well
(socket.setSoTimeout()). Even when using Spring AMQP you should be able
to specify your own ConnectionFactory that inherits from the existing one.

Regards

Emile


More information about the rabbitmq-discuss mailing list