heartbeat

Note

This class is not intended for use by those using Pika in their applications. This documentation is for those who are extending Pika or otherwise working on the driver itself.

Handle AMQP Heartbeats

HeartbeatChecker

class pika.heartbeat.HeartbeatChecker(connection, interval, idle_count=2)[source]

Checks to make sure that our heartbeat is received at the expected intervals.

MAX_IDLE_COUNT = 2
_CONNECTION_FORCED = 320
_STALE_CONNECTION = 'Too Many Missed Heartbeats, No reply in %i seconds'
active[source]

Return True if the connection’s heartbeat attribute is set to this instance.

:rtype True

bytes_received_on_connection[source]

Return the number of bytes received by the connection bytes object.

:rtype int

connection_is_idle[source]

Returns true if the byte count hasn’t changed in enough intervals to trip the max idle threshold.

received()[source]

Called when a heartbeat is received

send_and_check()[source]

Invoked by a timer to send a heartbeat when we need to, check to see if we’ve missed any heartbeats and disconnect our connection if it’s been idle too long.

_close_connection()[source]

Close the connection with the AMQP Connection-Forced value.

_has_received_data[source]

Returns True if the connection has received data on the connection.

Return type:bool
_new_heartbeat_frame()[source]

Return a new heartbeat frame.

:rtype pika.frame.Heartbeat

_send_heartbeat_frame()[source]

Send a heartbeat frame on the connection.

_setup_timer()[source]

Use the connection objects delayed_call function which is implemented by the Adapter for calling the check_heartbeats function every interval seconds.

_start_timer()[source]

If the connection still has this object set for heartbeats, add a new timer.

_update_counters()[source]

Update the internal counters for bytes sent and received and the number of frames received

Project Versions

Table Of Contents

Previous topic

frame

Next topic

simplebuffer

This Page