holinov / zio-event-sourcing

Purely functional concurent and scalable persistance layer implementing CQRS
38 stars 3 forks source link
cqrs cqrs-es event-sourcing persistence storage zio

ZIO Event Sourcing

ZIO EventSourcing is library trying to adopt one of CQRS implementations to ZIO way.

Description

Most of application could be seen as sequence of user initiated events that change state of the entire system. Keeping this in mind we could say that all entire system state could be restored just by playback of whole history of user initiated events, or some times just a part of them to business-logic processors (if they are "state less"). But also we need to keep in mind that modern time our services need to be fault-tolerant, scalable and able to adopt to always changing requirements of Clients and Business. And also we have requirement to provide our marketing team tools to allow to sell our product and keep KPI progress on it.

Combining previous requirements we have that modern system:

Event sourcing addresses this issues by separating "read side" and "write side" It has "event journal" which stores incoming events ordered in time for each entity ("Aggregate"). When entity state needs to be accessed "Aggregate" loads stored events and computes totals state

Concepts

Benefits

Drawbacks

Usage

resolvers += Resolver.bintrayRepo("holinov", "maven") 
libraryDependencies ++= Seq(
 "FruTTecH" %% "zio-event-sourcing" % "0.1.10",
 "FruTTecH" %% "zio-event-sourcing-serializer-protobuf" % "0.1.10",
 "FruTTecH" %% "zio-event-sourcing-file-store" % "0.1.10",
 "FruTTecH" %% "zio-event-sourcing-cassandra-store" % "0.1.10"
)

Roadmap