TransactionalEventHandler

Trait TransactionalEventHandler 

Source
pub trait TransactionalEventHandler<A, Er, Ex>: Sync
where A: Aggregate,
{ // Required method fn handle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 StoreEvent<A::Event>, executor: &'life2 mut Ex, ) -> Pin<Box<dyn Future<Output = Result<(), Er>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; // Provided methods fn delete<'life0, 'life1, 'async_trait>( &'life0 self, _aggregate_id: Uuid, _executor: &'life1 mut Ex, ) -> Pin<Box<dyn Future<Output = Result<(), Er>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn name(&self) -> &'static str { ... } }
Expand description

This trait is used to implement a TransactionalEventHandler. A transactional event handler is intended to be an entity which can create, update and delete a read side. No side effects must be performed inside of this kind on handler.

An handle operation will result in a deadlock if the implementation of this trait is used to apply an event on an Aggregate.

Required Methods§

Source

fn handle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 StoreEvent<A::Event>, executor: &'life2 mut Ex, ) -> Pin<Box<dyn Future<Output = Result<(), Er>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle an event in a transactional fashion and perform a read side crate, update or delete. If an error is returned the transaction will be aborted and the handling of a command by an aggregate will return an error.

Provided Methods§

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, _aggregate_id: Uuid, _executor: &'life1 mut Ex, ) -> Pin<Box<dyn Future<Output = Result<(), Er>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform a deletion of a read side projection using the given aggregate_id.

Source

fn name(&self) -> &'static str

The name of the event handler. By default, this is the type name of the event handler, but it can be overridden to provide a custom name. This name is used as part of tracing spans, to identify the event handler being run.

Implementors§

Source§

impl<A, Er, Ex, Q, T> TransactionalEventHandler<A, Er, Ex> for T
where A: Aggregate, A::Event: Send + Sync, Ex: Send, Q: TransactionalEventHandler<A, Er, Ex>, T: Deref<Target = Q> + Send + Sync,