예제 #1
0
        public IActorRef Create(IActorContext actorContext, ActorSetUpOptions options = null)
        {
            var props = actorContext.DI().Props(Actortype);

            props = PrepareProps(options, props);

            return(actorContext.ActorOf(props, name: ActorName));
        }
예제 #2
0
        public IActorRef Create(ActorSystem system, ActorSetUpOptions options = null)
        {
            var props = system.DI().Props(Actortype);

            props = PrepareProps(options, props);

            return(system.ActorOf(props, ActorName));
        }
예제 #3
0
 public static Props PrepareProps(ActorSetUpOptions options, Props props)
 {
     if (options != null)
     {
         if (options.RouterConfig != null)
         {
             props = props.WithRouter(options.RouterConfig);
         }
         if (options.SupervisoryStrategy != null)
         {
             props = props.WithSupervisorStrategy(options.SupervisoryStrategy);
         }
         if (options.Dispatcher != null)
         {
             props = props.WithDispatcher(options.Dispatcher);
         }
         if (options.MailBox != null)
         {
             props = props.WithMailbox(options.MailBox);
         }
     }
     return(props);
 }
 public static IActorRef CreateActor <T>(this IActorContext actorContext, ActorSetUpOptions option = null, ActorMetaData parentActorMetaData = null) where T : ActorBase
 {
     return(actorContext.System.CreateActorSelector <T>(parentActorMetaData).Create(actorContext, option));
 }