[rabbitmq-discuss] how do I change the connection timeout in the java client

Matthias Radestock matthias at lshift.net
Thu Nov 5 09:27:09 GMT 2009


Mark,

Mark Geib wrote:
> I need to be able to change the timeout for making a new connection to a
> broker to a smaller time. I have not been able to find out how to do
> this for the rabbitmq java client. Is there a way.??

Unfortunately javax.net.SocketFactory and its default implementations in 
the JDK, which is what the Java client is using, do not appear to 
support the setting of a connection timeout.

You could write your own implementation of the SocketFactory interface 
that creates sockets with a connection timeout, and supply instances of 
that implementation to com.rabbitmq.client.ConnectionFactory's 
setSocketFactory method.


Regards,

Matthias.




More information about the rabbitmq-discuss mailing list