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 watching all other actors within the actor system. Only when all those actors are stopped will it proceed with the system shutdown.