ActorES
An event sourcing and CQRS astraction that aims to be practical more than "go by the book". It's built on top of Riker a lightweight actor framework.
WARNING It's pretty much alpha quality at the moment, features are still missing and the API is still changing.
How to use
This library adds a few extra event-sourcing related concepts to Riker, most notably the entity which represents a domain where external commands and bussiness logic is handled. Created with the Entity
actor using the usual Riker machinery(see creating actors).
let entity = actor_system. `;
Defining your entity
Suppose MyEntity
is a user supplied struct that implements the ES
trait.
;
Models and rehidrating an entity's state
Define your aggregate(the data model), the updates it can handle and how to apply them.
Dispatching commands and queries
RikerES provides an entity manager that will create and manage your entities
when they are register
ed. It provides a simpler API to send commands and queries to the right entity.
let mgr = new.;
let id = mgr.command.await;
let data = mgr..await.unwrap;
In the meantime(while I find a way to make it more automagical) you'll also have to
implement EntityName
for both the entity and the command to be able to dispatch
commands to the right entity.