public ActorMetadata(string name, ActorMetadata parent = null) { Name = name; var parentPath = parent != null ? parent.Path : "/user"; Path = $"{parentPath}/{Name}"; }
public static async Task <IActorRef> CreateActorIfNotExistsAsync(this ActorSystem actorSystem, ActorMetadata actorPath, Props creationProps) { IActorRef actor = null; try { actor = await actorSystem.ActorSelection(actorPath.Path) .ResolveOne(TimeSpan.FromSeconds(1)); } catch (ActorNotFoundException) { actor = actorSystem.ActorOf(creationProps, actorPath.Name); } return(actor); }