input_devices
messageflux.iodevices.base.input_devices
AggregatedInputDevice
Bases: InputDevice[TManagerType]
this class is a round-robin input device, that reads from several underlying input devices in order
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manager |
TManagerType
|
the input device manager that created this device |
required |
inner_devices |
List[InputDevice]
|
the list of input devices to read from |
required |
InputDevice
Bases: Generic[TManagerType]
this is the base class for input devices
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manager |
TManagerType
|
the input device manager that created this device |
required |
name |
str
|
the name of this device |
required |
manager
property
Returns:
| Type | Description |
|---|---|
|
the input device manager that created this device |
read_message
this method returns a message from the device. and makes sure that the input device name header is present
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cancellation_token |
Event
|
the cancellation token for this service. this can be used to know if cancellation was requested |
required |
timeout |
Optional[float]
|
an optional timeout (in seconds) to wait for the device to return a message. after 'timeout' seconds, if the device doesn't have a message to return, it will return None |
None
|
with_transaction |
bool
|
'True' if the device should read message within transaction, or 'False' if the message is automatically committed |
True
|
Returns:
| Type | Description |
|---|---|
Optional[ReadResult]
|
a ReadResult object or None if no message was available. the device headers can contain extra information about the device that returned the message |
InputDeviceException
Bases: AggregatedException
a base exception class for all input device related exceptions
InputDeviceManager
Bases: Generic[TInputDeviceType]
this is the base class for input device managers. this class is used to create input devices.
delete_input_device_from_cache
deletes a cached input device from cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
the device to delete from cache |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the device existed and deleted, False otherwise |
get_aggregate_device
creates an aggregated input device on all the devices with given names
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names |
List[str]
|
the names of the devices to create and aggregate |
required |
Returns:
| Type | Description |
|---|---|
AggregatedInputDevice
|
the AggregatedInputDevice |
ReadResult
Bases: MessageBundle
this class holds the result for "read_message". adds the transaction to the message bundle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message |
Message
|
The Message. |
required |
device_headers |
Optional[DeviceHeaders]
|
Additional Headers that may return data from device, or affect its operation. |
None
|
transaction |
InputTransaction
|
the transaction returned by the reading device |
NULL_TRANSACTION
|