States are not being snapshotted

Hello guys, I was investigating the reason why my lagom persistent entities are taking a long time to respond after system startup and I’ve realized that Lagom is not storing states at all, so all events are being applied. I have tried to change the following parameters on the repective module’s application.conf and I still see the snapshots table empty even after more than 900 events:

tracker.cassandra.keyspace = tracker
cassandra-journal.keyspace = {tracker.cassandra.keyspace} cassandra-snapshot-store.keyspace = {tracker.cassandra.keyspace}
lagom.persistence {
read-side.cassandra.keyspace = ${tracker.cassandra.keyspace}
snapshot-after = 1
ask-timeout = 30s

On cassandra side:
cqlsh:tracker> select count(*) from tracker.snapshots ;




(1 rows)

cqlsh:tracker> select * from tag_write_progress ;

persistence_id | tag | offset | sequence_nr | tag_pid_sequence_nr
TrackAggregate|3eba7566-17c1-4b72-85da-6bf3f73f6b7a | net.zambot.tracker.impl.TrackEvent | 31bac850-a48d-11ea-877c-d3902d84eae9 | 917 | 917

(1 rows)

cqlsh:tracker> select count(*) from messages;



(1 rows)

java -version
java version “1.8.0_211”
Java™ SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot™ 64-Bit Server VM (build 25.211-b12, mixed mode)

val akkaVersion = “2.6.5”
scalaVersion in ThisBuild := “2.13.0”

addSbtPlugin(“com.lightbend.lagom” % “lagom-sbt-plugin” % “1.6.0”)

Are there circunstances where Lagom does not save snapshots? Would it be possible to debug the snapshotting process?

Thanks in advance for your attention,

Guilherme Zambon, the Zambot project.

After a further investigation reading the documentation at, I’ve realized that Lagom actually does not read the value from application.conf’s snapshot-after parameters, instead, it is reading from a declaration on the Aggregator, as follows:

private[impl] def create(persistenceId: PersistenceId) = EventSourcedBehavior
    .withEnforcedReplies[TrackCommand, TrackEvent, TrackState](
      persistenceId = persistenceId,
      emptyState = TrackState.initial,
      commandHandler = (tracker, cmd) => tracker.applyCommand(cmd),
      eventHandler = (tracker, evt) => tracker.applyEvent(evt)
    ).withRetention(RetentionCriteria.snapshotEvery(numberOfEvents = 10, keepNSnapshots = 1)

Hi @gzambon,

I’ve added a note on the settings (displayed on the docs aswel) indicating when those settings will apply.


Hello @ignasi35 - that looks great!

Regards, Guilherme Zambon, the Zambot project.