Intersections

class motorway.intersection.Intersection(process_uuid=None)[source]

Intersections receive messages and generate either:

  • A spin-off message

Spin-off messages will keep track of the state of the entire message tree and re-run it if failed. This means that if you want to re-run the message all the way from the ramp in case of an error, you should make a spin-off message.

Message.new(message, {
{
‘word’: ‘hello’, ‘count’: 1

}, grouping_value=’hello’

})

  • A brand new message

The message will be created with the intersection as producer. The intersection will not receive feedback if it is successful or not and hence will not be re-tried in the case of an error.

Message(uuid.uuid4()

process(message)[source]

This function is called continuously by the intersection.

Yield:motorway.messages.Message instance
Parameters:messagemotorway.messages.Message instance or list() if using motorway.decorators.batch_process()
receive_messages(context=None, output_stream=None, grouper_cls=None)[source]

Continously read and process using _process function

motorway.decorators.batch_process(wait=5, limit=100)[source]