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); }
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); }
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); }); }
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); }); }
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(); }
public override void Start() { // create the initial routees before scheduling the Router actor _router = _routerConfig.CreateRouter(System); _routerConfig.Match() .With <Pool>(pool => { var nrOfRoutees = pool.GetNrOfInstances(System); if (nrOfRoutees > 0) { AddRoutees(Vector.Fill <Routee>(nrOfRoutees)(() => pool.NewRoutee(_routeeProps, this))); } }) .With <Group>(group => { var paths = group.Paths; if (paths.NonEmpty()) { AddRoutees(paths.Select(p => group.RouteeFor(p, this)).ToList()); } }); PreSuperStart(); base.Start(); }