How it works...
In this recipe, we covered the different scenarios where your persistence actors can fail. Akka persistence needs to ensure consistency. That explains why it is strict about stopping an actor unconditionally when persist() or any of the variants do not work. We discovered that it also provides two methods to know what the state of recovery is: recoveryRunning and recoveryFinished. Both return a Boolean value. You can use them to check whether the recovery phase is completed or is still getting executed. Moreover, it provides two callbacks, onRecoveryFailure and onPersistFailure, to allow the developers some logic before unconditionally stopping the actor since it was not possible to recover or persist an event. It is advisable ...
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