Skip to content

pipeline_service

messageflux.pipeline_service

FixedRouterPipelineHandler

FixedRouterPipelineHandler(output_device_name)

Bases: PipelineHandlerBase

A pipeline handler that routes all messages to a single output device. without any processing.

handle_message

handle_message(input_device, message_bundle)

routes the message to the fixed output

Parameters:

Name Type Description Default
input_device InputDevice

The input device that sent the message.

required
message_bundle MessageBundle

The message that was received.

required

Returns:

Type Description
Optional[PipelineResult]

a pipeline result that has the input message bundle, and the fixed output device name

PipelineHandlerBase

a pipeline handler base class. used to handle a single message that passes through the pipeline

handle_message abstractmethod

handle_message(input_device, message_bundle)

Handles a message from an input device. and returns a tuple of the output device name, message and headers to send to.

Parameters:

Name Type Description Default
input_device InputDevice

The input device that sent the message.

required
message_bundle MessageBundle

The message that was received.

required

Returns:

Type Description
Optional[Union[PipelineResult, Iterable[PipelineResult]]]

None if the message should not be sent to any output device. PipelineResult (or iterable of) if messages should be sent to the output device with the given name.

prepare

prepare()

called when the service starts. can be overrided by child class to perform some initialization logic

shutdown

shutdown()

called when the service stops. can be overrided by child class to perform some cleanup logic

PipelineResult

PipelineResult(output_device_name, message_bundle)

a result from pipeline handler

PipelineService

PipelineService(
    *,
    input_device_manager,
    input_device_names,
    pipeline_handler,
    output_device_manager=None,
    **kwargs
)

Bases: MessageHandlingServiceBase

a service that uses a PipelineHandler object to process messages from input, and send to output

Parameters:

Name Type Description Default
pipeline_handler PipelineHandlerBase

the pipeline handler to use for handling the messages

required
output_device_manager Optional[OutputDeviceManager]

Optional. the output device manager to send messages to

None
**kwargs

passed to parent as is

{}