Shutdown patterns in Akka
By default, once an actor system is initialized, it stays alive until it is shut down explicitly. At first, it might seem easy to understand when to terminate an actor system, for example, if all mailboxes are empty and there is no actor processing a message for a given period of time. However, in Akka, things are more complex than that. It could be that there is a Future being processed and taking some time to complete. It could also happen an actor sent a message to a remote actor and it's waiting for the response in a remote/cluster environment.
There are different options to decide when an actor system is ready to be terminated. In this recipe, we will introduce the concept of reaper. Reaper will be an actor ...
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