castlecraft_engineer.abstractions.event_handler
¶
castlecraft_engineer.abstractions.event_handler
¶
EventHandler
¶
Bases: Generic[TEvent]
, ABC
Abstract base class for event handlers. Each handler is responsible for reacting to a specific type of domain event.
Source code in src/castlecraft_engineer/abstractions/event_handler.py
handle(event)
abstractmethod
async
¶
Handles the logic to execute when the specific event occurs. Marked as async to easily accommodate I/O operations (like sending emails, updating databases, calling APIs).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
TEvent
|
The event instance to be processed. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
This method must be implemented by concrete subclasses. |