Skip to content

abdheshkumar/akka-sample-persistence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This tutorial contains examples that illustrate a subset ofAkka Persistence features.

  • persistent actor
  • persistent actor snapshots
  • persistent actor recovery

Custom storage locations for the journal and snapshots can be defined in application.conf.

Persistent actor

PersistentActorExample.scala is described in detail in the Event sourcing section of the user documentation. With every application run, the ExamplePersistentActor is recovered from events stored in previous application runs, processes new commands, stores new events and snapshots and prints the current persistent actor state to stdout.

To run this example, type sbt "runMain sample.persistence.PersistentActorExample".

Persistent actor snapshots

SnapshotExample.scala demonstrates how persistent actors can take snapshots of application state and recover from previously stored snapshots. Snapshots are offered to persistent actors at the beginning of recovery, before any messages (younger than the snapshot) are replayed.

To run this example, type sbt "runMain sample.persistence.SnapshotExample". With every run, the state offered by the most recent snapshot is printed to stdout, followed by the updated state after sending new persistent messages to the persistent actor.

Persistent actor recovery

PersistentActorFailureExample.scala shows how a persistent actor can throw an exception, restart and restore the state by replaying the events.

To run this example, type sbt "runMain sample.persistence.PersistentActorFailureExample".

About

No description, website, or topics provided.

Resources

License

Unknown, CC0-1.0 licenses found

Licenses found

Unknown
LICENSE
CC0-1.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published