scalaakkaakka-supervision

How to get ActorRefs of all children of a RouterPool in Akka


I create a RouterPool of an actor like this:

val myActorPool = Akka.system.actorOf(RoundRobinPool(5).props(Props[MyActor]), "myActor")

now i would like to access the ActorRef objects of the 5 children that are managed by this router. Is there some method call to retrieve that for all children? Or do i have to declare them explicitly and then pass them to the router?


Solution

  • Sending akka.routing.GetRoutees to a router actor will make it send back its currently used routees in a akka.routing.Routees message

    from: http://doc.akka.io/docs/akka/2.3.11/scala/routing.html#Managagement_Messages