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

Bohuslav Svancara <>
Wed Apr 25 11:49:45 CEST 2012


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120425/d51e7b42/attachment.html>


More information about the erlang-questions mailing list