classes – Utility Classes¶
Defines some classes to use when implementing ZMQ devices
-
class
eventmq.utils.classes.HeartbeatMixin(*args, **kwargs)¶ Provides methods for implementing heartbeats
-
__init__(*args, **kwargs)¶ Sets up some variables to track the state of heartbeaty things
-
__weakref__¶ list of weak references to the object (if defined)
-
is_dead(now=None)¶ Checks the heartbeat counters to find out if the thresholds have been met.
Parameters: now (float) – The time to use to check if death has occurred. If this value is None, then utils.timeutils.monotonic()is used.Returns: True if the connection to the peer has died, otherwise False Return type: bool
-
reset_heartbeat_counters()¶ Resets all the counters for heartbeats back to 0
-
-
class
eventmq.utils.classes.ZMQReceiveMixin¶ Defines some methods for receiving messages. This class will not work if used on it’s own
-
__weakref__¶ list of weak references to the object (if defined)
-
recv()¶ Receive a message
-
recv_multipart()¶ Receive a multipart message
-
-
class
eventmq.utils.classes.ZMQSendMixin¶ Defines some methods for sending messages. This class will not work if used on it’s own
-
__weakref__¶ list of weak references to the object (if defined)
-
send(message, protocol_version)¶ Sends a message
Parameters: - message – message to send to something
- protocol_version (str) – protocol version. it’s good practice, but you may explicitly specify None to skip adding the version
-
send_multipart(message, protocol_version, _recipient_id=None)¶ Send a message directly to the 0mq socket. Automatically inserts some frames for your convience. The sent frame ends up looking something like this
(_recipient_id, ‘’, protocol_version) + (your, tuple)Parameters:
-