vortex.alive — PyVortex ALIVE module: ALIVE profile support

This modules includes all functions required to implement connection ALIVE through Vortex Library ALIVE implementation.

See notes from C API explaining how to use ALIVE API. Because this module is a binding for that API, all documentation applies:


Module API


Allows to init ALIVE module on the provided vortex.ctx reference. This is only required at the receiving side that is, the peer that will be monitored.

Parameters:ctx (vortex.ctx) – vortex context where ALIVE module will be initialized
Return type:true it initialization was completed, otherwise false is returned.
vortex.alive.enable_check(conn, check_period, max_unreply_count[, failure_handler][, failure_handler_data])

Activates the ALIVE connection check on the provided connection. The remote side must accept being monitored by calling to init(). In the case a failure_handler is provided it will be cause when the failure is found but the connection will not be closed. In the case the failure handler is not configured and a failure is found, the connection is shutted down.

The following show an example of a failure handler:

function failure_handler (conn, check_period, unreply_count, data)
    -- do something useful here
  • conn (vortex.connection) – The connection where the ALIVE process will take place.
  • check_period – The check period. It is defined in microseconds (1 second == 1000000 microseconds). To check every 20ms a* connection pass 20000. It must be > 0, or the function will return false.
  • max_unreply_count (Int) – The maximum amount of unreplied messages we accept. It must be > 0 or the function will return false.
  • failure_handler (Handler) – Optional handler called when a failure is detected.
  • failure_handler_data (Object) – Optional data passed to the failure handler
Return type:

true it initialization was completed, otherwise false is returned.