Thanks for the info ! Shing
On Wednesday, December 18, 2013 2:39:14 PM UTC, Patrik Nordwall wrote: > > Hi, > > This is actually one of the changes we have done to routers in upcoming > 2.3 version (you can try it in 2.3-M2). See > http://doc.akka.io/docs/akka/2.3-M2/scala/routing.html > We call this type of router a Group, and internally it just sends the > messages with actor selection. > > In 2.2.x you must start the target routee actors first, and replacing > actorFor with actor selection does not change this. > > /Patrik > > > > On Wed, Dec 18, 2013 at 12:35 PM, Shing <[email protected] <javascript:>>wrote: > >> >> In the code below, remoteListeners is a list of actor string path in >> remote Actor Systems. >> >> I use actorFor to get the ActorRef. >> >> >> val listenersActorRefs = remoteListeners.map(path => >> context.actorFor(path)).toList >> >> val router = >> context.actorOf(Props.empty.withRouter(BroadcastRouter(routees = >> listenersActorRefs)), "remoteListeners") >> >> >> Suppose the remote actors are not running when the above code is >> executed, and later, the remote actors are alive, then >> >> the router will automatically connect to the remote actors. >> >> >> As actorFor is deprecated, I try replacing actorFor with actorSelection >> and use the following to get ActorRef >> >> >> def getActorRef(path:String, context:ActorContext):ActorRef={ >> >> implicit val timeout = Timeout(3, TimeUnit.SECONDS); >> >> val future = context.actorSelection(path).resolveOne().mapTo[ActorRef] >> >> >> val futureTimeout = Duration(3, TimeUnit.SECONDS); >> >> val actorRef = Await.result(future, futureTimeout) >> >> actorRef >> >> } >> >> >> The above works if all the remote actors are alive at the beginning. If >> remote actors are not alive at the beginning, I do not get the automatic >> connect >> >> behaviour when the remote actors are alive. >> >> Is there a way to use actorSelection with the "lazy connect" behaviour ? >> >> Thanks in advance for your assistance ! >> >> >> Shing >> >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user >> --- >> You received this message because you are subscribed to the Google Groups >> "Akka User List" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > > Patrik Nordwall > Typesafe <http://typesafe.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
