eventually 0.4.0

Crate for using Event Sourcing in Rust applications
Documentation

A library providing components to build event-sourced applications.

The eventually crate provides base abstractions to design your application domain using Domain-driven Design, using the Aggregate trait, and provides a set of nice utilities around those core abstractions: EventStore, Repository, Subscription and Projection.

Event Sourcing Primer

Event Sourcing is an architectural pattern which requires domain entities' (in ES lingo, Aggregates) internal state to be mutated and persisted as a list of Domain Events, rather than serializing the whole state to the database (as you would do with a typical CRUD architecture).

Events are persisted in an Event Store: an ordered, append-only log of all the events produced in your domain.

Events can be retrieved from an Event Store through Event Streams, stream of chronologically-ordered events.

The state of your Aggregates can thus be rebuilt by streaming all the Events back in the application, as they happened in time, to build the latest version of the state.

This architectural pattern brings in a lot of interesting goodies:

  • Auditing: never need to guess what happened in your system, thanks to the Event Store, you have a list of all the Events that have been committed during time.
  • Time-machine: travel back in time, by setting the state of your service to a specific point in time, thanks to the Event Store; useful for debugging purposes.
  • Projections: create read-optimized models of your Aggregates as needed for you business operations, continuously, every time new Events are committed to the Event Store.
  • Concurrency Handling: Event-sourced application make extensive use of Optimistic Concurrency to handle concurrent-writes scenarios -- concurrency conflicts and state reconciliation can become part of your Domain!
  • High Performance, High Availability: thanks to the append-only Event Store and the use of Projections, you can write highly performant and highly available services that handle an intense amount of traffic.

More information about this pattern can be found here.