Snapshot store plugin

The snapshot plugin enables storing and loading snapshots for event sourced persistent actors.

Schema

The snapshot table need to be created in the configured database, see schema definition in Creating the schema.

Configuration

To enable the snapshot plugin to be used by default, add the following line to your Pekko application.conf:

pekko.persistence.snapshot-store.plugin = "pekko.persistence.r2dbc.snapshot"

It can also be enabled with the snapshotPluginId for a specific EventSourcedBehavior and multiple plugin configurations are supported.

See also Connection configuration.

Reference configuration

The following can be overridden in your application.conf for the snapshot specific settings:

sourcepekko.persistence.r2dbc {
  snapshot {
    class = "org.apache.pekko.persistence.r2dbc.snapshot.R2dbcSnapshotStore"
    table = "snapshot"

    # Otherwise it would be a pinned dispatcher, see https://github.com/akka/akka/issues/31058
    plugin-dispatcher = "pekko.actor.default-dispatcher"
  }
}

Usage

The snapshot plugin is used whenever a snapshot write is triggered through the Pekko Persistence APIs.