castlecraft_engineer.abstractions.event_publisher
¶
castlecraft_engineer.abstractions.event_publisher
¶
ExternalEventPublisher
¶
Bases: ABC
Abstract base class for publishing domain events to external messaging systems (e.g., Kafka, RabbitMQ, Redis Streams).
Source code in src/castlecraft_engineer/abstractions/event_publisher.py
close()
abstractmethod
async
¶
publish(events)
abstractmethod
async
¶
Publishes a list of domain events to the external broker.
Implementations should handle serialization,connection management, and the specifics of the chosen message broker protocol.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
events
|
List[Event]
|
A list of domain event instances to publish. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
This method must be implemented by concrete subclasses. |
Exception
|
Implementation-specific exceptions related to publishing failures (e.g., connection errors, serialization issues). |