On 15 August 2014 at 18:26:10, Ján Kianička (
jan.ki...@gmail.com) wrote:
> > I know that this feature is supported by official client implementations:
> Java, .NET and Erlang.
Of the official ones, only Java.
> But we are limited to c. We are now having constantly open connection.
> And I have made experiments to reconnect by catching response
> library exception from 'amqp_consume_message'.
> This works only on 'gracefull' shutdown scenario when client
> side of TCP connection is alerted about the connection failure.
> But the cluster has VIP mechanism which moves virtual IP to other
> nod, and running open connections just start to hang without
> any error.
> There is coming connection interruption only after TCP keep
> alive on both sides expire (the host system kernel configured
> one).
> Don't you have someone resolved this issue of client's robustness
> in C?
This is why the protocol has heartbeats: to detect broken TCP connections
quicker. Keepalive timeouts with default settings on most OSes are so
high they are useless for messaging (or virtually anything, really).
> I am thinking about setting socket keep alive per connection,
> but amqp_socket is somehow different that standard socket in
> C and did not work with getsockopt() and setsockopt().
> Also I am thinking about amqp keep alive implementation, but
> I did not find some examples in C using librabbitmq-c. Don't you
> have someone experience?
Implementing heartbeats correctly and reliably assumes the library
can use a separate thread (or similar). In case of the C client, there
is no consensus about how that should be done, from what I see.
But it's good someone is starting this conversation.
--
MK
Staff Software Engineer, Pivotal/RabbitMQ