Trait eventsourcing::Dispatcher[][src]

pub trait Dispatcher {
    type Command;
    type Event: Event;
    type State: AggregateState;
    type Aggregate: Aggregate<Event = Self::Event, Command = Self::Command, State = Self::State>;
    fn dispatch(
        state: &Self::State,
        cmd: Self::Command,
        store: &impl EventStore,
        stream: &str
    ) -> Vec<Result<CloudEvent>>; }

A dispatcher is a type of pipeline glue that eliminates a certain set of boilerplate code for when you want to emit the events produced through the application of a command immediately to a store, for a given event stream name. You don't have to build a dispatcher yourself, you can use a derive macro to make a placeholder struct your dispatcher. The result of a dispatch is a vector capturing the success of command application. If it succeeded, you will get a CloudEvent, a CloudEvents v0.1 spec-compliant data structure.

Associated Types

Required Methods

Implementors