feat: add EventConsumer port to domain

This commit is contained in:
2026-05-10 02:50:58 +02:00
parent 9c11ac2bcc
commit a8092a140d

View File

@@ -173,6 +173,13 @@ pub trait EventPublisher: Send + Sync {
async fn publish(&self, event: &DomainEvent) -> Result<(), DomainError>;
}
#[async_trait]
pub trait EventConsumer: Send + Sync {
/// Returns the next available event, or `None` if the stream has ended.
/// Implementations decide whether this blocks (push) or polls (DB queue).
async fn next_event(&self) -> Result<Option<DomainEvent>, DomainError>;
}
#[async_trait]
pub trait PasswordHasher: Send + Sync {
async fn hash(&self, plain_password: &str) -> Result<PasswordHash, DomainError>;