February 2018
Intermediate to advanced
552 pages
13h 46m
English
Stopping an Actor means shutting it down gracefully, once its job is finished. We can use the following options to shut down an Actor.
Within an Actor, we can use the context object to stop it:
context.stop(self)
Here, self means referring itself, the Actor from which we are making this call to stop itself.
As shown in the following example, we can also use ActorSystem's terminate() function to stop or shut down the whole ActorSystem so that all of its Actors are stopped automatically:
actorSystem.terminate()
Read now
Unlock full access