/// <summary> /// Initializes a new instance of the <see cref="ClusterRouterPoolActor"/> class. /// </summary> /// <param name="supervisorStrategy">The strategy used to supervise the pool.</param> /// <param name="settings">The settings used to configure the router.</param> /// <exception cref="ActorInitializationException"> /// This exception is thrown when this actor is configured as something other than a <see cref="Akka.Routing.Pool"/> router. /// </exception> public ClusterRouterPoolActor(SupervisorStrategy supervisorStrategy, ClusterRouterPoolSettings settings) : base(settings) { _supervisorStrategy = supervisorStrategy; Settings = settings; var pool = Cell.RouterConfig as Pool; if (pool != null) { Pool = pool; } else { throw new ActorInitializationException( $"RouterPoolActor can only be used with Pool, not {Cell.RouterConfig.GetType()}"); } }
public void Cluster_aware_routers_must_use_provided_supervisor_strategy() { var escalator = new OneForOneStrategy( exception => { TestActor.Tell("supervised"); return Directive.Stop; }); var settings = new ClusterRouterPoolSettings(1, 1, true); var router = Sys.ActorOf( new ClusterRouterPool(new RoundRobinPool(1, null, escalator, Dispatchers.DefaultDispatcherId), settings) .Props(Props.Create(() => new KillableActor(TestActor))), "therouter"); router.Tell("go away"); ExpectMsg("supervised"); }
internal RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null) { return(new ClusterRouterPool(local ?? Local, settings ?? Settings)); }
public ClusterRouterPoolActor(SupervisorStrategy supervisorStrategy, ClusterRouterPoolSettings settings) : base(settings) { Settings = settings; _supervisorStrategy = supervisorStrategy; _pool = (Pool)Cell.RouterConfig; }
public RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null) { return new ClusterRouterPool(local ?? (Pool)Local, settings ?? (ClusterRouterPoolSettings)Settings); }
public ClusterRouterPool(Pool local, ClusterRouterPoolSettings settings) { Settings = settings; Local = local; RouterDispatcher = local.RouterDispatcher; if(local.Resizer != null) throw new ConfigurationException("Resizer can't be used together with cluster router."); NrOfInstances = Settings.AllowLocalRoutees ? settings.MaxInstancesPerNode : 0; Resizer = local.Resizer; SupervisorStrategy = local.SupervisorStrategy; }
public ClusterRouterPoolActor(SupervisorStrategy supervisorStrategy, ClusterRouterPoolSettings settings) : base(settings) { _supervisorStrategy = supervisorStrategy; Settings = settings; var pool = Cell.RouterConfig as Pool; if (pool != null) { Pool = pool; } else { throw new ActorInitializationException("RouterPoolActor can only be used with Pool, not " + Cell.RouterConfig.GetType()); } }
internal RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null) { return new ClusterRouterPool(local ?? Local, settings ?? Settings); }
public ClusterRouterPool(Pool local, ClusterRouterPoolSettings settings) : base(settings.AllowLocalRoutees ? settings.MaxInstancesPerNode : 0, local.Resizer, local.SupervisorStrategy, local.RouterDispatcher, false) { if (local.Resizer != null) throw new ConfigurationException("Resizer can't be used together with cluster router."); Settings = settings; Local = local; }
public ClusterRouterPoolActor(SupervisorStrategy supervisorStrategy, ClusterRouterPoolSettings settings) : base(settings) { Settings = settings; _supervisorStrategy = supervisorStrategy; _pool = (Pool)Cell.RouterConfig; }
public RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null) { return(new ClusterRouterPool(local ?? (Pool)Local, settings ?? (ClusterRouterPoolSettings)Settings)); }