fastmessage_handler
fastmessage.fastmessage_handler
FastMessage
Bases: PipelineHandlerBase
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_output_device |
Optional[str]
|
an optional default output device to send callback results to, unless mapped otherwise |
None
|
validation_error_handler |
Optional[Callable[[InputDevice, MessageBundle, ValidationError], Optional[Union[PipelineResult, Iterable[PipelineResult]]]]]
|
an optional handler that will be called on validation errors, in order to give the user a chance to handle them gracefully |
None
|
create_service
create_service(
*,
input_device_manager,
input_device_names=None,
output_device_manager=None,
**kwargs
)
creates a PipelineService, with this FastMessage object as its handler
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_device_manager |
InputDeviceManager
|
the input device manager to read items from |
required |
input_device_names |
Optional[Union[List[str], str]]
|
Optional. the list of input device names to read from (defaults to all the registered mappings) |
None
|
output_device_manager |
Optional[OutputDeviceManager]
|
Optional. the output device manager to use |
None
|
**kwargs |
passed to PipelineService init as is |
{}
|
Returns:
| Type | Description |
|---|---|
PipelineService
|
the created PipelineService |
map
this is the decorator method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_device |
str
|
the input device to register the decorated method on |
_DEFAULT
|
output_device |
Optional[str]
|
optional output device to route the return value of the callback to. if callback returns None, no routing will be made even if 'output_device' is not None None means no output routing |
_DEFAULT
|
register_callback
registers a callback to a device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback |
_CALLABLE_TYPE
|
the callback to register |
required |
input_device |
str
|
the input device to register the callback to |
_DEFAULT
|
output_device |
Optional[str]
|
optional output device to route the return value of the callback to. None means no output routing. if callback returns None, no routing will be made even if 'output_device' is not None |
_DEFAULT
|
register_validation_error_handler
registers optional handler that will be called on validation errors, in order to give the user a chance to handle them gracefully
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler |
Callable[[InputDevice, MessageBundle, ValidationError], Optional[PipelineResult]]
|
the handler to register |
required |