in reply to check if conx to Net::RabbitMQ is still alive

It looks to me like the heartbeat parameter will determine how often you need to send a heartbeat frame; it's up to you to make sure that happens. I don't see that there is a way to get the server to tell you it's about to disconnect. You need to store somewhere in your program the last time you interacted with the server.

But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

  • Comment on Re: check if conx to Net::RabbitMQ is still alive

Replies are listed 'Best First'.
Re^2: check if conx to Net::RabbitMQ is still alive
by perl_help26 (Beadle) on Jun 22, 2016 at 14:44 UTC
    So I need to say somewhere in my code : if X amount of time has passed $rabbitmq->heartbeat() ? is this what you mean ? Or setting the param will do this by itself?

      Yes. It will not automatically send the heartbeat. The RabbitMQ documentation indicates that heartbeating is intended to allow for quicker detection of a lost connection. Any activity on the connection counts as a heartbeat; you only need to send an explicit beat if nothing else is happening.

      But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)