Reputation: 28016
Using Akka.net with remoting. This article has the following to say about using ActorSelection:
The other time when I tend to use an ActorSelection is when I am initially communicating with a remote actor system.
What I don't quite understand is how to convert that initial ActorSelection into an IActorRef that I can continue to use.
Upvotes: 8
Views: 1696
Reputation: 7542
The simplest way here is to use actorSelection.ResolveOne(timeout)
method, which will return Task<IActorRef>
. Task may also end with timeout or ActorNotFoundException
in case when no actor was found under provided path.
Another - more actor-idiomatic - way is to send Identify(correlationId)
message to actor selection. It should respond with ActorIdentity(correlationId, actorRef)
reply. Be aware that it may not respond at all, if there was no one to listen under provided actor selection.
Upvotes: 12