Trait DomainEventHandler

Source
pub trait DomainEventHandler<T: AggregateRootEx>: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        entity: T,
        event: T::DomainEvent,
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for representing a Domain Event Handler.

See AggregateRootEx for more information about Domain Events and the example for RepositoryEx about this trait’s usage.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, entity: T, event: T::DomainEvent, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handles the incoming domain event, applying any necessary changes to the entity.

Implementors§