Messages

class motorway.messages.Message(ramp_unique_id, content=None, ack_value=None, controller_queue=None, grouping_value=None, error_message=None, process_name=None, producer_uuid=None, destination_endpoint=None, destination_uuid=None)[source]
Parameters:
  • ramp_unique_id – the unique message ID delivered back upon completion to the ramp
  • content – any json serializable content
  • grouping_value – String that can be used for routing messages consistently to the same receiver
Returns:

ack(time_consumed=None)[source]

Send a message to the controller that this message was properly processed

fail(error_message='', capture_exception=True)[source]

Send a message to the controller that this message failed to process

classmethod from_message(message, controller_queue, process_name=None)[source]
Parameters:
  • message – Message dict (converted from JSON)
  • controller_queue
  • process_name – UUID of the process processing this message (as string)
Returns:

classmethod new(message, content, grouping_value=None, error_message=None)[source]
Creates a new message, based on an existing message. This has the consequence that it will be tracked together
and the tap will not be notified until every message in the chain is properly ack’ed.
Parameters:
  • message – Message instance, as received by the intersection
  • content – Any value that can be serialized into json
  • grouping_value – String that can be used for routing messages consistently to the same receiver
send_control_message(controller_queue, time_consumed=None, process_name=None, destination_endpoint=None, destination_uuid=None, sender=None)[source]

Control messages are notifications that a new message have been created, so the controller can keep track of this particular message and let the ramp know once the entire tree of messages has been completed.

This is called implicitly on yield Message(_id, ‘message’)

Parameters:process_name – UUID of the process processing this message (as string)