Message Bus¶
Important
The synchronous version is generated from the async version
Async¶
Propagate commands and events to every registered handles.
- exception purgatory.service._async.messagebus.ConfigurationError¶
Prevents bad usage of the add_listener.
- class purgatory.service._async.messagebus.AsyncMessageRegistry¶
Store all the handlers for commands an events.
- add_listener(msg_type: type[Message], callback: Callable[[Any, AsyncAbstractUnitOfWork], Coroutine[Any, Any, Any]] | Callable[[Any, AsyncAbstractUnitOfWork], Coroutine[Any, Any, None]]) None ¶
- remove_listener(msg_type: type, callback: Callable[[Any, AsyncAbstractUnitOfWork], Coroutine[Any, Any, Any]] | Callable[[Any, AsyncAbstractUnitOfWork], Coroutine[Any, Any, None]]) None ¶
- async handle(message: Message, uow: AsyncAbstractUnitOfWork) Any ¶
Notify listener of that event registered with messagebus.add_listener. Return the first event from the command.
Sync¶
Propagate commands and events to every registered handles.
- exception purgatory.service._sync.messagebus.ConfigurationError¶
Prevents bad usage of the add_listener.
- class purgatory.service._sync.messagebus.SyncMessageRegistry¶
Store all the handlers for commands an events.
- add_listener(msg_type: type[Message], callback: Callable[[Any, SyncAbstractUnitOfWork], Any] | Callable[[Any, SyncAbstractUnitOfWork], None]) None ¶
- remove_listener(msg_type: type, callback: Callable[[Any, SyncAbstractUnitOfWork], Any] | Callable[[Any, SyncAbstractUnitOfWork], None]) None ¶
- handle(message: Message, uow: SyncAbstractUnitOfWork) Any ¶
Notify listener of that event registered with messagebus.add_listener. Return the first event from the command.