Пример #1
0
        public RoutedActorCell(ActorSystem system, InternalActorRef supervisor, Props routerProps, Props routeeProps, ActorPath path,
                               Mailbox mailbox)
            : base(system, supervisor, routerProps, path, mailbox)
        {
            RouteeProps  = routeeProps;
            routerConfig = routerProps.RouterConfig;
            Router       = routerConfig.CreateRouter(system);
            routerConfig.Match()
            .With <Pool>(r =>
            {
                var routees = new List <Routee>();
                for (int i = 0; i < r.NrOfInstances; i++)
                {
                    var routee = this.ActorOf(RouteeProps);
                    routees.Add(new ActorRefRoutee(routee));
                }
                AddRoutees(routees.ToArray());
            })
            .With <Group>(r =>
            {
                var routees = routerConfig.GetRoutees(this).ToArray();
                AddRoutees(routees);
            });



            Self = new RoutedActorRef(path, this);
        }
Пример #2
0
        public RoutedActorCell(ActorSystem system, InternalActorRef supervisor, Props routerProps, Props routeeProps, ActorPath path,
            Mailbox mailbox)
            : base(system, supervisor, routerProps, path, mailbox)
        {
            RouteeProps = routeeProps;
            routerConfig = routerProps.RouterConfig;
            Router = routerConfig.CreateRouter(system);
            routerConfig.Match()
                .With<Pool>(r =>
                {
                    var routees = new List<Routee>();
                    for (int i = 0; i < r.NrOfInstances; i++)
                    {
                        var routee = this.ActorOf(RouteeProps);
                        routees.Add(new ActorRefRoutee(routee));
                    }
                    AddRoutees(routees.ToArray());
                })
                .With<Group>(r =>
                {
                    var routees = routerConfig.GetRoutees(this).ToArray();
                    AddRoutees(routees);
                });



            Self = new RoutedActorRef(path, this);
        }
Пример #3
0
 public RoutedActorCell(ActorSystemImpl system, InternalActorRef self, Props routerProps, MessageDispatcher dispatcher, Props routeeProps, InternalActorRef supervisor)
     : base(system, self, routerProps, dispatcher, supervisor)
 {
     _routeeProps = routeeProps;
     _routerConfig = routerProps.RouterConfig;
     _router = _routerConfig.CreateRouter(system);
     _routerConfig.Match()
         .With<Pool>(r =>
         {
             var routees = new List<Routee>();
             for(int i = 0; i < r.NrOfInstances; i++)
             {
                 var routee = ActorOf(_routeeProps);
                 routees.Add(new ActorRefRoutee(routee));
             }
             AddRoutees(routees.ToArray());
         })
         .With<Group>(r =>
         {
             var routees = _routerConfig.GetRoutees(this).ToArray();
             AddRoutees(routees);
         });
 }
Пример #4
0
 public RoutedActorCell(ActorSystemImpl system, InternalActorRef self, Props routerProps, MessageDispatcher dispatcher, Props routeeProps, InternalActorRef supervisor)
     : base(system, self, routerProps, dispatcher, supervisor)
 {
     _routeeProps  = routeeProps;
     _routerConfig = routerProps.RouterConfig;
     _router       = _routerConfig.CreateRouter(system);
     _routerConfig.Match()
     .With <Pool>(r =>
     {
         var routees = new List <Routee>();
         for (int i = 0; i < r.NrOfInstances; i++)
         {
             var routee = ActorOf(_routeeProps);
             routees.Add(new ActorRefRoutee(routee));
         }
         AddRoutees(routees.ToArray());
     })
     .With <Group>(r =>
     {
         var routees = _routerConfig.GetRoutees(this).ToArray();
         AddRoutees(routees);
     });
 }
Пример #5
0
 public override void Start()
 {
     // create the initial routees before scheduling the Router actor
     _router = _routerConfig.CreateRouter(System);
     _routerConfig.Match()
     .With <Pool>(r =>
     {
         var routees = new List <Routee>();
         for (var i = 0; i < r.GetNrOfInstances(System); i++)
         {
             var routee = r.NewRoutee(_routeeProps, this);
             routees.Add(routee);
         }
         AddRoutees(routees.ToArray());
     })
     .With <Group>(r =>
     {
         var routees = _routerConfig.GetRoutees(this).ToArray();
         AddRoutees(routees);
     });
     PreSuperStart();
     base.Start();
 }