<div dir="ltr">Hi Emile,<br><br>Thank you very much, your response is much appreciated. It's great to know we can expect to see this option (in the near future?).<br><br>As a side note: I would have been able to implement the first option you suggested, except that I work with Spring AMQP. It's impossible to pass on a custom ConnectionFactory instead of rabbit's own to it due to the lack of an interface. If rabbit's ConnectionFactory was an interface, Spring AMQP (and other frameworks) could use that interface instead of the direct implementation, thus, allowing framework users to pass on custom connection factories.<br>
<br>Have a great day.<br><br>Best Regards,<br><br><div class="gmail_quote">On Wed, Oct 27, 2010 at 1:40 PM, Emile Joubert <span dir="ltr"><<a href="mailto:emile@rabbitmq.com">emile@rabbitmq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi again Amr,<br>
<div><div></div><div class="h5"><br>
On 27/10/10 12:01, Emile Joubert wrote:<br>
> Hi Amr,<br>
><br>
> On 23/10/10 19:20, Amr Mostafa wrote:<br>
>> Hi,<br>
>><br>
>> I've been searching around for a way to specify a connect timeout in the<br>
>> Java client, but couldn't find an easy way to do that. There is one way,<br>
>> which is by extending ConnectionFactory with a custom createFrameHandler<br>
>> method, but that doesn't work with my case since I'm using Spring AMQP<br>
>> support on top of the client API.<br>
>><br>
>> It would be very useful to add an option for that in the<br>
>> ConnectionFactory which, if specified, would be passed to the socket<br>
>> connect call.<br>
><br>
> You can also set socket options by overriding<br>
> ConnectionFactory.configureSocket(). By default this hook disables<br>
> Nagle's algorithm, but it can be used to set the timeout as well<br>
> (socket.setSoTimeout()). Even when using Spring AMQP you should be able<br>
> to specify your own ConnectionFactory that inherits from the existing one.<br>
<br>
</div></div>My previous advice won't work, because SO_TIMEOUT doesn't affect the<br>
connection timeout. Instead of overriding configureSocket(), you need to<br>
override createFrameHandler(). The call to socket.connect(addr) needs to<br>
be changed to the 2-parameter version that accepts a connection timeout.<br>
<br>
Another option would be to supply your own SocketFactory that supplies<br>
sockets that override connect().<br>
<br>
Given the difficulty of both these options we will look at extending the<br>
ConnectionFactory API to make this simpler, as you suggested.<br>
<br>
Regards<br>
<font color="#888888"><br>
Emile<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Amr Mostafa<br>Egypt Development Center<br>Member of NTG<br>Mobile: +(2012)1700502<br>Office: +(202)24052355/6 - Ext.: 2005<br>
</div>