/// <summary> /// Initializes a new instance of the <see cref="RandomPool"/> class. /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param> /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param> /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param> public RandomPool( int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { }
public ResizablePoolCell(ActorSystemImpl system, IInternalActorRef self, Props routerProps, MessageDispatcher dispatcher, Props routeeProps, IInternalActorRef supervisor, Pool pool) : base(system,self, routerProps,dispatcher, routeeProps, supervisor) { if (pool.Resizer == null) throw new ArgumentException("RouterConfig must be a Pool with defined resizer"); resizer = pool.Resizer; _routerProps = routerProps; _pool = pool; _resizeCounter = new AtomicCounterLong(0); _resizeInProgress = new AtomicBoolean(); }
public ResizablePoolCell(ActorSystem system, InternalActorRef supervisor, Props routerProps, Props routeeProps, ActorPath path, Mailbox mailbox, Pool pool) : base(system, supervisor, routerProps, routeeProps, path, mailbox) { if (pool.Resizer == null) throw new ArgumentException("RouterConfig must be a Pool with defined resizer"); resizer = pool.Resizer; this._pool = pool; this._resizeCounter = 0; this._resizeInProgress = ResizeInProgressState.False; }
/// <summary> /// </summary> /// <param name="nrOfInstances">The nr of instances.</param> /// <param name="resizer">The resizer.</param> /// <param name="supervisorStrategy">The supervisor strategy.</param> /// <param name="routerDispatcher">The router dispatcher.</param> /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param> public ScatterGatherFirstCompletedPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher,TimeSpan within, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { _within = within; }
/// <summary> /// Initializes a new instance of the <see cref="RoundRobinPool"/> class. /// /// <note> /// A <see cref="RoundRobinPool"/> configured in this way uses the <see cref="Pool.DefaultStrategy"/> supervisor strategy. /// </note> /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> public RoundRobinPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, DefaultStrategy, null) { }
/// <summary> /// Creates a new <see cref="ScatterGatherFirstCompletedPool" /> router with a given <see cref="Resizer" />. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public override Pool WithResizer(Resizer resizer) { return new ScatterGatherFirstCompletedPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, _within, UsePoolDispatcher); }
/// <summary> /// Creates a new <see cref="SmallestMailboxPool" /> router with a given <see cref="Routing.Resizer" />. /// /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Routing.Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public SmallestMailboxPool WithResizer(Resizer resizer) { return new SmallestMailboxPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher); }
/// <summary> /// Initializes a new instance of the <see cref="BroadcastPool"/> class. /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param> /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param> /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param> public BroadcastPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { }
/// <summary> /// </summary> /// <param name="nrOfInstances">The nr of instances.</param> /// <param name="resizer">The resizer.</param> /// <param name="supervisorStrategy">The supervisor strategy.</param> /// <param name="routerDispatcher">The router dispatcher.</param> /// <param name="within">Expect a response within the given timespan</param> /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param> public ScatterGatherFirstCompletedPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, TimeSpan within, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { _within = within; }
/// <summary> /// Creates a new <see cref="ScatterGatherFirstCompletedPool" /> router with a given <see cref="Resizer" />. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public ScatterGatherFirstCompletedPool WithResizer(Resizer resizer) { return(new ScatterGatherFirstCompletedPool(NrOfInstances, resizer, Within, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher)); }
/// <summary> /// Creates a new <see cref="RoundRobinPool"/> router with a given <see cref="Resizer"/>. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer"/>.</returns> public RoundRobinPool WithResizer(Resizer resizer) { return new RoundRobinPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher); }
/// <summary> /// Initializes a new instance of the <see cref="RoundRobinPool"/> class. /// <note> /// A <see cref="RoundRobinPool"/> configured in this way uses the <see cref="Pool.DefaultSupervisorStrategy"/> supervisor strategy. /// </note> /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> public RoundRobinPool(int nrOfInstances, Resizer resizer) : this(nrOfInstances, resizer, Pool.DefaultSupervisorStrategy, Dispatchers.DefaultDispatcherId) { }
/// <summary> /// Creates a new <see cref="SmallestMailboxPool" /> router with a given <see cref="Routing.Resizer" />. /// /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Routing.Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public SmallestMailboxPool WithResizer(Resizer resizer) { return(new SmallestMailboxPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher)); }
/// <summary> /// Sets the resizer to use for the pool. /// </summary> /// <param name="strategy">The resizer to use.</param> /// <returns>The tail chopping pool.</returns> public TailChoppingPool WithResizer(Resizer resizer) { Resizer = resizer; return(this); }
/// <summary> /// Creates a new <see cref="RandomPool" /> router with a given <see cref="Resizer" />. /// /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public override Pool WithResizer(Resizer resizer) { return(new RandomPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher)); }
/// <summary> /// Initializes a new instance of the <see cref="TailChoppingPool"/> class. /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param> /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param> /// <param name="within">The amount of time to wait for a response.</param> /// <param name="interval">The interval to wait before sending to the next routee.</param> /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param> public TailChoppingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, TimeSpan within, TimeSpan interval, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { Within = within; Interval = interval; }
/// <summary> /// Initializes a new instance of the <see cref="ConsistentHashingPool"/> class. /// </summary> /// <param name="nrOfInstances">The initial number of routees in the pool.</param> /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param> /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param> /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param> /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param> /// <param name="virtualNodesFactor">The number of virtual nodes to use on the hash ring.</param> /// <param name="hashMapping">The consistent hash mapping function to use on incoming messages.</param> public ConsistentHashingPool( int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false, int virtualNodesFactor = 0, ConsistentHashMapping hashMapping = null) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { VirtualNodesFactor = virtualNodesFactor; _hashMapping = hashMapping; }
/// <summary> /// Simple form of RoundRobin constructor /// </summary> /// <param name="nrOfInstances">The nr of instances.</param> /// <param name="resizer">A <see cref="Resizer"/> for specifying how to grow the pool of underlying routees based on pressure</param> public RoundRobinPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, DefaultStrategy, null) { }
/// <summary> /// Creates a new <see cref="BroadcastPool"/> router with a given <see cref="Resizer"/>. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public BroadcastPool WithResizer(Resizer resizer) { return(new BroadcastPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher)); }
/// <summary> /// Returns a new instance of the <see cref="Pool"/> router with a new <see cref="Resizer"/>. /// /// NOTE: this method is immutable and returns a new instance of the <see cref="Pool"/>. /// </summary> public abstract Pool WithResizer(Resizer resizer);
/// <summary> /// Sets the resizer to use for the pool. /// </summary> /// <param name="strategy">The resizer to use.</param> /// <returns>The tail chopping pool.</returns> public TailChoppingPool WithResizer(Resizer resizer) { Resizer = resizer; return this; }
/// <summary> /// Creates a new <see cref="ConsistentHashingPool" /> router with a given <see cref="Resizer" />. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// <note> /// Using <see cref="Resizer"/> with <see cref="ConsistentHashingPool"/> is potentially harmful, as hash ranges /// might change radically during live message processing. This router works best with fixed-sized pools or fixed /// number of routees per node in the event of clustered deployments. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public ConsistentHashingPool WithResizer(Resizer resizer) { return(new ConsistentHashingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher, VirtualNodesFactor, _hashMapping)); }
protected Pool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false) { NrOfInstances = nrOfInstances; Resizer = resizer; SupervisorStrategy = supervisorStrategy ?? Pool.DefaultStrategy; UsePoolDispatcher = usePoolDispatcher; RouterDispatcher = routerDispatcher; }
/// <summary> /// Simple form of RandomPool constructor /// </summary> /// <param name="nrOfInstances">The nr of instances.</param> /// <param name="resizer">A <see cref="Resizer"/> for specifying how to grow the pool of underlying routees based on pressure</param> public RandomPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, Pool.DefaultStrategy, null) { }
public override Pool WithResizer(Resizer resizer) { return new RemoteRouterConfig(Local.WithResizer(resizer), Nodes); }
/// <summary> /// Creates a new <see cref="RoundRobinPool"/> router with a given <see cref="Resizer"/>. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer"/>.</returns> public RoundRobinPool WithResizer(Resizer resizer) { return(new RoundRobinPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher)); }
/// <summary> /// Initializes a new instance of the <see cref="FromConfig" /> class. /// </summary> /// <param name="resizer">TBD</param> /// <param name="supervisorStrategy">TBD</param> /// <param name="routerDispatcher">TBD</param> public FromConfig(Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher) : base(0, resizer, supervisorStrategy, routerDispatcher, false) { }
public override Pool WithResizer(Resizer resizer) { return new BroadcastPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher); }
/// <summary> /// Setting the resizer to be used. /// </summary> /// <param name="resizer">TBD</param> /// <returns>TBD</returns> public FromConfig WithResizer(Resizer resizer) { return(new FromConfig(resizer, SupervisorStrategy, RouterDispatcher)); }
/// <summary> /// Creates a new <see cref="TailChoppingPool"/> router with a given <see cref="Resizer"/>. /// /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer"/>.</returns> public TailChoppingPool WithResizer(Resizer resizer) { return new TailChoppingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, Within, Interval, UsePoolDispatcher); }
/// <summary> /// Creates a new <see cref="TailChoppingPool"/> router with a given <see cref="Resizer"/>. /// /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer"/>.</returns> public override Pool WithResizer(Resizer resizer) { return(new TailChoppingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, _within, _interval, UsePoolDispatcher)); }
/// <summary> /// Creates a new <see cref="ConsistentHashingPool" /> router with a given <see cref="Resizer" />. /// <note> /// This method is immutable and returns a new instance of the router. /// </note> /// <note> /// Using <see cref="Resizer"/> with <see cref="ConsistentHashingPool"/> is potentially harmful, as hash ranges /// might change radically during live message processing. This router works best with fixed-sized pools or fixed /// number of routees per node in the event of clustered deployments. /// </note> /// </summary> /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param> /// <returns>A new router with the provided <paramref name="resizer" />.</returns> public ConsistentHashingPool WithResizer(Resizer resizer) { return new ConsistentHashingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher, VirtualNodesFactor, _hashMapping); }
/// <summary> /// Initializes a new instance of the <see cref="ConsistentHashingPool"/> class. /// </summary> /// <param name="nrOfInstances">The nr of instances.</param> /// <param name="resizer">The resizer.</param> /// <param name="supervisorStrategy">The supervisor strategy.</param> /// <param name="routerDispatcher">The router dispatcher.</param> /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param> public ConsistentHashingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false) : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher) { }