3.3. Messaging

class snakemq.messaging.Messaging(identifier, domain, packeter, queues_storage=None)
__init__(identifier, domain, packeter, queues_storage=None)
Parameters:
  • identifier – peer identifier
  • domain – currently unused
  • packeterPacketer
  • queues_storageQueuesStorageBase
send_message(ident, message)

Thread safe.

Parameters:
  • ident – destination address
  • messageMessage

3.3.1. Callbacks

Messaging.on_connect = None

func(conn_id, ident)

Messaging.on_disconnect = None

func(conn_id, ident)

Messaging.on_message_recv = None

func(conn_id, ident, message)

Messaging.on_message_sent = None

func(conn_id, ident, message_uuid)

Messaging.on_message_drop = None

func(ident, message_uuid) Called when the message is dropped from the queue due to the TTL timeout.

3.3.2. Keep-alive

Messaging.keepalive_interval = None

time to ping, in seconds (None = no keepalive)

Messaging.keepalive_wait = None

wait for pong, in seconds

3.3.3. Message

class snakemq.message.Message(data, ttl=0, flags=0, uuid=None)
__init__(data, ttl=0, flags=0, uuid=None)
Parameters:
  • data – (bytes) payload
  • ttl – messaging TTL in seconds (integer or float), None is infinity
  • flags – combination of FLAG_*
  • uuid – (bytes) unique message identifier (implicitly generated)
snakemq.message.FLAG_PERSISTENT = 1

store to a persistent storage

Table Of Contents

Previous topic

3.2. Packeter

Next topic

3.4. Miscellaneous

This Page