In a nutshell

Endless bridges the gap between Cats Effect and Pekko/Akka Cluster Sharding. It makes it possible to define abstract repository and entity algebras in tagless-final style to describe distributed event sourced domains seamlessly within functional codebases. Writing applications using endless’s abstraction layer also makes it easy to switch between actor frameworks.

Implementation of the various aspects of an entity can be done using endless typeclasses and abstractions:

  • Sharding: represents the ability to interact with a specific entity in the cluster
  • Entity: ability to read entity state, write events and produce a reply (direct state persistence is supported with DurableEntity)
  • EventApplier: description of how to fold events over entity state
  • CommandProtocol: ability to translate entity algebra invocations into serializable commands and replies
  • CommandSender: ability to deliver a command to its target entity, and provide the reply back to the sender (transport layer)
  • Effector: ability to produce side effects after event persistence, including control of entity passivation and chaining further interactions with the entity itself

The provided Pekko/Akka runtimes are a thin layer over Cluster Sharding. They rely exclusively on the usual public APIs (the Persistence DSL in particular) and allow for full customization of the entity behavior if lower-level tweaks are required.

Genericity

Abstractions defined here are universal and could also be operated with a different event-sourcing framework or even a custom implementation. At the moment, built-in support for both Pekko and Akka is provided. A native implementation for Kubernetes is also in the works.

For more info

Check out the blog article Functional event-sourcing with cats-effect