dddmisc-messagebus
d3m.messagebus
Realisation EDA for DDD projects
Messagebus
Bases: IMessagebus
d3m.core.IMessagebus implementation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lifespan |
Lifespan[_MessagebusT] | None
|
async context manager entered when first run and exit after close |
None
|
Methods:
Name | Description |
---|---|
subscribe |
Subscribe a listener to one or more events of the message bus. |
unsubscribe |
Unsubscribe a listener from one or more events of the message bus. |
run |
Run the message bus. |
run_until_complete |
Run the message bus until the execution of a specified command. |
stop |
Stop the message bus. |
close |
Close the message bus. |
is_running |
Check if the message bus is running. |
is_closed |
Check if the message bus is closed. |
include_collection |
Include a collection of handlers in the message bus. |
handle_message |
Handle a message and return a future representing the completion of the handling. |
get_context |
Get the context of the current instance. |
set_defaults |
Set defaults for the domain's command's handlers. |
MessagebusPolicy
Bases: IMessagebusPolicy
Default policy implementation for accessing the messagebus.
In this policy, each thread has its own messagebus. However, we only automatically create a messagebus by default for the main thread; other threads by default have no event loop.
Other policies may have different rules (e.g. a single global messagebus, or automatically creating a messagebus per thread, or using some other notion of context to which a messagebus is associated).
Methods:
Name | Description |
---|---|
get_messagebus |
Get the messagebus for the current context. |
set_messagebus |
Set the messagebus for the current context. |
new_messagebus |
Create and return a new messagebus object, according to this policy's rules. |