How it works...
In this recipe, you have learned that we need to create an explicit object to shut down our persistent actors instead of using the PoisonPill object that we normally use for regular actors. We created ShutdownPersistentActor for this purpose. We can check the behavior of PoisonPill and the custom message separately by looking at the output generated by SafePersistenceActorShutdownApp. When shutting down with PoisonPill, we can see the Stopping [akka://safe-shutdown/user/$a] message first and then two info logs advertising that our UserUpdate message didn't get received by the actor. When shutting down with ShutdownPersistentActor, we simply see Stopping [akka://safe-shutdown/user/$b], indicating that the two messages have ...
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