Event Publisher¶
Outbound port for asynchronously publishing domain events.
This module defines an EventPublisher that sends domain events to an
external message bus or event broker. Infrastructure implementations
determine durability, ordering, and delivery guarantees.
Responsibilities:
- Publish domain events after domain changes occur.
- Forward events to a message bus.
Non-Responsibilities:
- Persist events.
- Guarantee ordering or durability.
event_publisher
¶
Outbound port for asynchronously publishing domain events.
This module defines an EventPublisher that sends domain events to an
external message bus or event broker. Infrastructure implementations
determine durability, ordering, and delivery guarantees.
Responsibilities
- Publish domain events after domain changes occur.
- Forward events to a message bus.
Non-Responsibilities
- Persist events.
- Guarantee ordering or durability.
EventPublisher
¶
Bases: OutboundPort[Event, None]
Outbound port for publishing domain events asynchronously.
An EventPublisher provides an abstraction over event transport. Use cases
or application services call it to publish domain events after state
transitions. The underlying MessageBus determines the delivery semantics.
Source code in src/forging_blocks/application/ports/outbound/event_publisher.py
publish(event: Event) -> None
async
¶
Publish a domain event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The domain event to publish. |
required |
Notes
- Asynchronous and fire-and-forget.
- Delivery reliability depends on the MessageBus implementation.