How it works...
In this recipe, we used ActorSelection to look up a remote actor. To begin with, we started a remote application that created an actor named remoteActor. Then, we started an application that looked for it by passing akka.tcp://LookingUpRemoteActors@127.0.0.1:2553/user/remoteActor to ActorSelection.
ActorSelection traverses the hierarchy of the actors in the path to look for the desired actor. ActorSelection does not create any actors if the entered path is not inhabited by a previously created actor. To get ActorRef from an actor, we need to call resolveOne(), which returns the actual reference to the actor. This operation takes time and happens asynchronously; this is why the method returns a Future[ActorRef].
Here, we used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access