samy samy -3 years ago 136
Scala Question

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?

Answer Source

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download