How does Akka handle an actor's mailbox when a Kill message triggers a supervisor restart?
15K reputation · 26 Aug 2020, 00:50 UTC
In an Akka system, an actor can be terminated by sending a Kill message, which throws an ActorKilledException and is processed by the actor's supervisor. Assuming the default supervisor strategy (which stops the actor and then restarts it), what happens to the messages that were already in the actor's mailbox at the moment the Kill was processed? Are those messages retained and available after the actor restarts, or are they discarded? Additionally, how does this behavior differ from using a Stop or PoisonPill signal, and what steps should be taken to verify that the mailbox persists across a restart when troubleshooting a failure?