How it works...
In this recipe, we covered how to use snapshots with our persistent actor. We have seen that snapshots dramatically help reduce the recovery time for our persistent actors. To demonstrate this, we have created a new actor, SnapshotActor. Every time this actor receives a snap command, it will call saveSnapshot(state) to save a current version of the state. This operation can either be successful, or it can fail. If it succeeds, your actor will receive a SaveSnapshotSuccess message with a metadata object that contains the persistence ID, the sequence number of your snapshot, and a timestamp. If it fails, your actor will receive a SaveSnapshotFailure message with some metadata and a reason why it failed. We can see an example ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access