Exemple #1
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="id">TBD</param>
        /// <param name="message">TBD</param>
        /// <param name="payload">TBD</param>
        /// <param name="sender">TBD</param>
        protected virtual void DeliverTo(string id, object message, object payload, IActorRef sender)
        {
            var name  = Uri.EscapeDataString(id);
            var child = _context.Child(name);

            if (Equals(child, ActorRefs.Nobody))
            {
                GetEntity(id).Tell(payload, sender);
            }
            else
            {
                child.Tell(payload, sender);
            }
        }
        public static IActorRef GetOrAdd <TActor>(this IActorContext context, string?name)
            where TActor : ActorBase, new()
        {
            var child = context.Child(name);

            return(child.Equals(ActorRefs.Nobody) ? context.ActorOf <TActor>(name) : child);
        }
 private IActorRef LookupOrCreateTodoChildActor(IActorContext context, string name)
 {
     var child = context.Child(name);
     if (child.Equals(ActorRefs.Nobody)) //child doesn't exist
     {
         return Context.ActorOf(Props.Create(() => new MessageProducerChildActor()),
             name);
     }
     return child;
 }
Exemple #4
0
 public static Maybe <IActorRef> TryGetChild(this IActorContext context, Maybe <string> name) =>
 (
     from realName in name
     select string.IsNullOrWhiteSpace(realName) ? ActorRefs.Nobody : context.Child(realName)
 ).Or(ActorRefs.Nobody);
 public static IActorRef Child <TIdentity>(this IActorContext context, TIdentity identity)
     where TIdentity : IIdentity
 {
     return(context.Child(identity.Value));
 }
 public void ResolveChild()
 {
     _cell.Child(_getMessage.Name);
 }
        public static IActorRef GetOrAdd(this IActorContext context, string?name, Props props)
        {
            var child = context.Child(name);

            return(child.Equals(ActorRefs.Nobody) ? context.ActorOf(props, name) : child);
        }
 /// <inheritdoc />
 public IActorRef Child(IActorContext context, string name)
 {
     return(context.Child(name));
 }