/// <summary> /// Construct an <see cref="Akka.Actor.ActorSelection"/> from the given path, which is /// parsed for wildcards (these are replaced by regular expressions /// internally). No attempt is made to verify the existence of any part of /// the supplied path, it is recommended to send a message and gather the /// replies in order to resolve the matching set of actors. /// </summary> public static ActorSelection ActorSelection(string path, ActorSystem system, IActorRef lookupRoot) { var provider = ((ActorSystemImpl)system).Provider; //no path given if (string.IsNullOrEmpty(path)) { return(new ActorSelection(system.DeadLetters, "")); } //absolute path var elements = path.Split('/'); if (elements[0] == "") { return(new ActorSelection(provider.RootGuardian, elements.Skip(1))); } if (Uri.IsWellFormedUriString(path, UriKind.Absolute)) { ActorPath actorPath; if (!ActorPath.TryParse(path, out actorPath)) { return(new ActorSelection(provider.DeadLetters, "")); } var actorRef = provider.RootGuardianAt(actorPath.Address); return(new ActorSelection(actorRef, actorPath.Elements)); } return(new ActorSelection(lookupRoot, path)); }
/// <summary> /// TBD /// </summary> /// <param name="path">TBD</param> /// <returns>TBD</returns> public IActorRef ResolveActorRef(string path) { if (ActorPath.TryParse(path, out var actorPath) && actorPath.Address == _rootPath.Address) { return(ResolveActorRef(_rootGuardian, actorPath.Elements)); } _log.Debug("Resolve of unknown path [{0}] failed. Invalid format.", path); return(_deadLetters); }