val badLookup = context.children find (_.path.name == "kid") // should better be expressed as: val goodLookup = context.actorFor("kid")
Hello,When looking up an actorcontext.actorFor( "myactor" )an ActorRef will be returned for the running actor or an ActorRef that forwards messages to the dead letter actor will be returned. The path for both of these will be:akka://MySystem/myparent/myactorwhich means that I can't ever tell if I actually have an actor running.
I can look up children from a parent using context.children.find(..... but as the docs mentionval badLookup = context.children find (_.path.name == "kid") // should better be expressed as: val goodLookup = context.actorFor("kid")this is a slow way to look up actors especially if a parent has thousands/hundreds of thousands of children.
My path forward has been to keep a HashMap of the actor name and the actor ref and use context.watch( child ) to remove actors from the map when they shut themselves down.
Am I correct that there really isn't a way to look up a running actor in 2.0, and actually know if it is the actor you wanted?
Thanks,Andy--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Hey Andy,
Thanks,Andy
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Killer thanks. Just making sure. I'm battling the upgrade beast and I almost have it licked.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/9gNLzvJBLb8J.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/IgiXQuy_y3cJ.
To post to this group, send email to akka...@googlegroups.com.