[−][src]Crate eventmill
Abstractions
Event applied to an aggregate state results in a modified aggregate state:
(aggregate, Event) -> aggregate'
Commands are handled by aggregates resulting in a zero, one or several events:
(Aggregate, Command) -> Vec<NewEvent>
(NewEvent, Store) -> DomainEvent
Aggregates have a generation property. The generation of an aggregate enumerates the number of modifications through a sequence of applied events.
Applying an event to an aggregate advances its state from the current generation n to the next generation n+1:
(Aggregate(n), DomainEvent) -> Aggregate(n+1)
Aggregates can be replayed by applying all stored events to a newly initialized aggregate:
(initialized aggregate, &[DomainEvent]) -> current aggregate
Dispatching a Command
Given a command we need to find the right aggregate instance to handle it.
When dispatcher gets the aggregate instance it calls the handle_command function. The returned
list of events (Vec<NewEvent>
) will be enriched with the address properties of the aggregate to
get the related DomainEvent
s.
Re-exports
pub use crate::aggregate::Aggregate; |
pub use crate::aggregate::AggregateIdOf; |
pub use crate::aggregate::AggregateState; |
pub use crate::aggregate::AggregateType; |
pub use crate::aggregate::Generation; |
pub use crate::aggregate::InitializeAggregate; |
pub use crate::aggregate::VersionedAggregate; |
pub use crate::aggregate::WithAggregateId; |
pub use crate::command::DomainCommand; |
pub use crate::command::HandleCommand; |
pub use crate::dispatch::DispatchCommand; |
pub use crate::dispatch::DispatchEvent; |
pub use crate::event::DomainEvent; |
pub use crate::event::EventType; |
pub use crate::event::NewEvent; |
pub use crate::event::Sequence; |
pub use crate::metadata::Metadata; |
pub use crate::query::ReceiveEvent; |
pub use crate::store::EventSink; |
pub use crate::store::EventSinkError; |
pub use crate::store::EventSource; |
pub use crate::store::EventSourceError; |
Modules
aggregate | |
command | |
dispatch | |
event | |
inmemory_store | |
metadata | |
query | |
store | |
test_support |
Derive Macros
AggregateType | |
EventType |