Money crashes alone will not cause any heartbeat unless there are messages to consume and acknowledge. If the queue is inactive, then the connection will be closed (by the rabbit server or your firewall).
What you need to do is use both the pulse and the timeout:
while True: try: conn.drain_events(timeout=1) except socket.timeout: conn.heartbeat_check()
Thus, even if the queue is in standby mode, the connection will not be closed.
In addition, you can wrap it all up with a retry policy in case of a connection closure or some other network error.
odedfos
source share