Trait cqrs_es::Query

source ·
pub trait Query<A: Aggregate>: Send + Sync {
    // Required method
    fn dispatch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        aggregate_id: &'life1 str,
        events: &'life2 [EventEnvelope<A>]
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Each CQRS platform should have one or more queries where it will distribute committed events.

Some example of tasks that queries commonly provide:

  • update materialized views
  • publish events to messaging service
  • trigger a command on another aggregate

Required Methods§

source

fn dispatch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, aggregate_id: &'life1 str, events: &'life2 [EventEnvelope<A>] ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Events will be dispatched here immediately after being committed.

Implementors§

source§

impl<R, V, A> Query<A> for GenericQuery<R, V, A>
where R: ViewRepository<V, A>, V: View<A>, A: Aggregate,