Struct cqrs_es2::CqrsFramework[][src]

pub struct CqrsFramework<A, ES, AC> where
    A: Aggregate,
    ES: EventStore<A, AC>,
    AC: AggregateContext<A>, 
{ /* fields omitted */ }
Expand description

This is the base framework for applying commands to produce events.

In Domain Driven Design we require that changes are made only after loading the entire Aggregate in order to ensure that the full context is understood. With event-sourcing this means:

  1. loading all previous events for the aggregate instance
  2. applying these events, in order, to a new Aggregate
  3. using the recreated Aggregate to handle an inbound Command
  4. persisting any generated events or rolling back on an error

To manage these tasks we use a CqrsFramework.

Implementations

Creates new framework for dispatching commands using the provided elements.

This applies a command to an aggregate. Executing a command in this way is the only way to make any change to the state of an aggregate.

An error while processing will result in no events committed and an AggregateError being returned.

If successful the events produced will be applied to the configured QueryProcessors.

Error

If an error is generated while processing the command this will be returned.

This applies a command to an aggregate along with associated metadata. Executing a command in this way to make any change to the state of an aggregate.

A Hashmap<String,String> is supplied with any contextual information that should be associated with this change. This metadata will be attached to any produced events and is meant to assist in debugging and auditing. Common information might include:

  • time of commit
  • user making the change
  • application version

An error while processing will result in no events committed and an AggregateError being returned.

If successful the events produced will be applied to the configured QueryProcessors.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.