[erlang-questions] Ho to keep-alive inactive RabbitMQ connections?

Max Bourinov <>
Wed Apr 25 13:16:15 CEST 2012


Hi Bob,

I have 1 to 1 architecture as you described. It works fine! But I cannot
understand how it is possible that RabbitMQ client process loses connection
WITHOUT crash? It just ABSOLUTELY silently loses connection and I know
about it from RabbitMQ management interface only.

This is very strange... This is why I asked the List.

Best regards,
Max




On Wed, Apr 25, 2012 at 1:49 PM, Bohuslav Svancara <>wrote:

> Yes. Connection is closed if a heartbeat pulse does not arrive.
> You need to open connection again.
> The best way (I think)  is to let module crash and its supervisor will
> restart (and reconnect) it.
>
> I have "topRabbitSupervisor", which starts "rabbitConnection" module.
> rabbitConnection module opens connection and starts amqp subscribers which
> use this open connection.
>
> If any of amqp subscribers lose a connection (heartbeat did not arrive) it
> crashes, crash propagates to topRabbitSupervisor and
> topRabbitSupervisor restarts rabbitConnection which restarts all
> subscribers then.
>
> It seems it works fine.
>
> Bob
>
> Dne 25. dubna 2012 8:40 Max Bourinov <> napsal(a):
>
> Hi Tilman!
>>
>> I have it! It is 5 seconds in my case.
>>
>> *{ok, Connection} = amqp_connection:start(*
>> *        #amqp_params_network{*
>> *            host = "localhost",*
>> *            username = <<"guest">>,*
>> *            password = <<"guest">>,*
>> *            port = 5672,*
>> *            virtual_host = <<"/">>,*
>> *            heartbeat = 5*
>> *        }),*
>>
>>
>> Still dropping connections...
>>
>> Best regards,
>> Max
>>
>>
>>
>>
>> On Wed, Apr 25, 2012 at 10:36 AM, Tilman Holschuh <
>> > wrote:
>>
>>> Hi Max,
>>>
>>> Check out AMQP heartbeat.
>>>
>>> Cheers
>>> - Tilman
>>>
>>> On 2012-04-24, at 11:26 PM, Max Bourinov wrote:
>>>
>>> > Hi Erlangers,
>>> >
>>> > I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client
>>> >
>>> > While testing it I noticed that if connection is not active for some
>>> hours it becomes closed. Interesting thing is that my Erlang app doesn't
>>> show any crashes or error messages. SASL is enabled, process that holds
>>> connection is under supervision.
>>> >
>>> > Does anybody know how RabbitMQ client must be configured to keep
>>> connection alive all the time?
>>> >
>>> > Best regards,
>>> > Max
>>> >
>>> >
>>> > _______________________________________________
>>> > erlang-questions mailing list
>>> > 
>>> > http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120425/34a22a72/attachment.html>


More information about the erlang-questions mailing list