Akka Persistence

Just like objects in OOP, actors keep their state in volatile memory. When a system shuts down (gracefully or because of a crash) all data that was in memory is lost. Akka Persistence provides the means to persist an Actor state using Event Sourcing. Upon startup, events can be replayed to restore the state of the entity hosted by the actor. The event stream can be queried and fed into additional processing pipelines (an external Big Data cluster for example) or alternate views (like reports).

Persistence tackles the following challenges:

  • How to restore the state of an entity/actor when system restarts or crashes.

  • How to ensure reliable delivery of messages in face of network errors and system crashes.

  • How to introspect domain events that have led an entity to its current state.

  • How to leverage Event Sourcing in your application to support long-running processes while the project continues to evolve.

  • How to implement a CQRS system.

The Event Sourced Cart entity in the Microservices tutorial illustrates how to implement an Event Sourced CQRS application with Akka Persistence.

Persistence Plugins

Storage backends for journals and snapshot stores are pluggable in the Akka persistence extension. Plugins maintained within the Akka organization include plugins for Cassandra and JDBC databases.

Learn more