Stop all participants in the system without shutting down the system?

Is there a good way in Akka 2.0 to close all participants under start / user? For example, suppose I do the following:

val system = ActorSystem.create("mySystem")

system.actorOf(Props(new MyActor1), "actor1")
system.actorOf(Props(new MyActor2), "actor2")

After some time, I decided that I want to stop all participants in the system. If I understand things correctly, actor1 and actor2 will be the children of the path / user, but I don't see a method that gives me the iterability of the children of ActorRef. Is there another way?

+5
source share
1 answer

Use actor selection to send PoisonPill to all top-level actors:

system.actorSelection("/user/*") ! PoisonPill
+12
source

All Articles