messages – Message Utilities

eventmq.utils.messages.fwd_emqp_router_message(socket, recipient_id, payload)

Forwards payload to socket untouched.

Parameters:
  • socket – socket to send the message with
  • recipient_id (str) – the id of the connected device to reply to
  • payload (tuple) – The message to send. The first frame should be an empty string
eventmq.utils.messages.generate_msgid(prefix=None)

Returns a random string to be used for message ids. Optionally the ID can be prefixed with prefix.

Parameters:prefix (str) – Value to prefix on to the random part of the id. Useful for prefixing some meta data to use for things
eventmq.utils.messages.parse_message(message)

Parses the generic format of an eMQP/1.0 message and returns the parts.

Parameters:message – the message you wish to have parsed

Returns (tuple) (command, message_id, (message_body, and_data))

eventmq.utils.messages.parse_router_message(message)

Parses the generic format of an eMQP/1.0 message and returns the parts.

Parameters:message – the message you wish to have parsed

Returns (tuple) (sender_id, command, message_id, (message_body, and_data))

eventmq.utils.messages.send_emqp_message(socket, command, message=None)

Formats and sends an eMQP message

Parameters:
  • socket
  • command
  • message

Raises:

Returns:Message id for this message
Return type:str
eventmq.utils.messages.send_emqp_router_message(socket, recipient_id, command, message=None)

Formats and sends an eMQP message taking into account the recipient frame used by a zmq.ROUTER device.

Parameters:
  • socket – socket to send the message with
  • recipient_id (str) – the id of the connected device to reply to
  • command (str) – the eMQP command to send
  • message – a msg tuple to send
Returns
str: Message id for this message