示例#1
0
        public ActorMetadata(string name, ActorMetadata parent = null)
        {
            Name = name;

            var parentPath = parent != null ? parent.Path : "/user";
            Path = $"{parentPath}/{Name}";

            Parent = parent;
        }
示例#2
0
        public ActorMetadata(string name, ActorMetadata parent = null)
        {
            Name = name;

            var parentPath = parent != null ? parent.Path : "/user";

            Path = $"{parentPath}/{Name}";

            Parent = parent;
        }
示例#3
0
 public static ActorSelection ActorSelection(this ActorSystem actorSystem, ActorMetadata actor, ActorPathType path = ActorPathType.Absolute)
 {
     return(actorSystem.ActorSelection(actor.Path));
     //switch (path)
     //{
     //    case ActorPathType.Absolute:
     //        return actorSystem.ActorSelection(actor.AbsoluteUri);
     //    case ActorPathType.Relative:
     //        return actorSystem.ActorSelection(actor.RelativeUri);
     //    default:
     //        return actorSystem.ActorSelection(actor.AbsoluteUri);
     //}
 }
示例#4
0
 WithInjectedActorSelection <TLimit, TActivatorData, TRegistrationStyle>(this IRegistrationBuilder <TLimit, TActivatorData, TRegistrationStyle> builder, ActorMetadata actorEntry, ActorPathType pathType) where TActivatorData : ReflectionActivatorData
 {
     return(builder.WithParameter((param, ctx) => param.Name == actorEntry.Name, (param, ctx) =>
     {
         var actorSystem = ctx.Resolve <IActorSystemAdapter>();
         return actorSystem.ActorSelection(actorEntry.Path);
     }));
 }
示例#5
0
 WithInjectedActor <TLimit, TActivatorData, TRegistrationStyle>(this IRegistrationBuilder <TLimit, TActivatorData, TRegistrationStyle> builder, ActorMetadata actorEntry) where TActivatorData : ReflectionActivatorData
 {
     return(builder.WithParameter((param, ctx) => param.Name == actorEntry.Name, (param, ctx) => ctx.ResolveNamed <IActorRef>(actorEntry.Name)));
 }
示例#6
0
 RegisterActor <TActor>(this ContainerBuilder builder, ActorSystem system, AutoFacDependencyResolver props, ActorMetadata actorEntry) where TActor : ActorBase
 {
     return(builder.Register(ctx => system.ActorOf(props.Create <TActor>(), actorEntry.Name)).Named <IActorRef>(actorEntry.Name));
     //var actorInstance = system.ActorOf(props.Create<TActor>(), actorEntry.Name);
     //return builder.RegisterInstance(actorInstance).Named<IActorRef>(actorEntry.Name);
 }
示例#7
0
 public ActorMetadata(string name, Type actorType, ActorMetadata parent = null) : this(name, parent)
 {
     ActorType = actorType;
 }
示例#8
0
 public ActorMetadata(Type actorType, ActorMetadata parent = null) : this(null, actorType, parent)
 {
 }
示例#9
0
 public IActorRef ActorOf <TProps>(ActorMetadata actor) where TProps : ActorBase
 {
     return(_actorSystem.ActorOf(_actorSystem.DI().Props <TProps>(), actor.Name));
 }
示例#10
0
 public IActorRef ActorOf(ActorMetadata actor)
 {
     return(_actorSystem.ActorOf(_actorSystem.DI().Props(actor.ActorType), actor.Name));
 }
示例#11
0
 public ActorMetadata(string name, Type actorType, ActorMetadata parent = null)
     : this(name, parent)
 {
     ActorType = actorType;
 }
示例#12
0
 public ActorMetadata(Type actorType, ActorMetadata parent = null)
     : this(null, actorType, parent)
 {
 }
示例#13
0
 public static IActorRef ActorOf(this IUntypedActorContext context, ActorMetadata actor)
 {
     return(context.ActorOf(context.DI().Props(actor.ActorType), actor.Name));
 }
示例#14
0
 public static ActorSelection ActorSelection(this IUntypedActorContext context, ActorMetadata actor, ActorPathType path = ActorPathType.Absolute)
 {
     return(context.ActorSelection(actor.Path));
     //switch (path)
     //{
     //    case ActorPathType.Absolute:
     //        return context.ActorSelection(actor.Path);
     //    case ActorPathType.Relative:
     //        return context.ActorSelection(actor.RelativeUri);
     //    default:
     //        return context.ActorSelection(actor.AbsoluteUri);
     //}
 }