minos.networks.brokers.dispatchers.impl
Classes
Broker Dispatcher class. |
- class BrokerDispatcher[source]
Bases:
SetupMixin
Broker Dispatcher class.
- __init__(actions, publisher, **kwargs)[source]
- Parameters
actions (dict[str, Optional[collections.abc.Callable]]) –
publisher (BrokerPublisher) –
- property publisher: minos.networks.brokers.publishers.abc.BrokerPublisher
Get the publisher instance.
- Returns
A
BrokerPublisher
instance.
- property actions: dict[str, Optional[collections.abc.Callable]]
Actions getter.
- Returns
A dictionary in which the keys are topics and the values are the handler.
- async dispatch(message)[source]
Dispatch an entry.
- Parameters
message (BrokerMessage) – The entry to be dispatched.
- Returns
This method does not return anything.
- Return type
None
- static get_callback(fn)[source]
Get the handler function to be used by the Broker Handler.
- Parameters
fn (Callable[[BrokerRequest], Union[BrokerResponse, None, Awaitable[Optional[BrokerResponse]]]]) – The action function.
- Returns
A wrapper function around the given one that is compatible with the Broker Handler API.
- Return type
Callable[[BrokerMessage], Awaitable[BrokerMessageV1Payload]]
- async destroy()
Destroy miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- classmethod from_config(config=None, **kwargs)
Build a new instance from config.
- Parameters
config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.
kwargs – Additional named arguments.
- Returns
A instance of the called class.
- Return type
S
- async setup()
Setup miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None