Skip to main content

FactoryArgumentsBuilder

Struct FactoryArgumentsBuilder 

Source
pub struct FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State = (Unset<Required>, Unset<Optional>, Unset<Required>, Unset<Required>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>)>
where TKey: JobKey, TMsg: Message, TWorkerStart: Message, TWorker: Actor<Msg = WorkerMessage<TKey, TMsg>, Arguments = WorkerStartContext<TKey, TMsg, TWorkerStart>>, TRouter: Router<TKey, TMsg>, TQueue: Queue<TKey, TMsg>,
{ /* private fields */ }
Expand description

Use builder syntax to set the required parameters and finish by calling the method Self::build().

Implementations§

Source§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, __WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where TKey: JobKey, TMsg: Message, TWorkerStart: Message, TWorker: Actor<Msg = WorkerMessage<TKey, TMsg>, Arguments = WorkerStartContext<TKey, TMsg, TWorkerStart>>, TRouter: Router<TKey, TMsg>, TQueue: Queue<TKey, TMsg>,

Source

pub fn build( self, ) -> FactoryArguments<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue>
where __WorkerBuilder: IntoSet<Box<dyn WorkerBuilder<TWorker, TWorkerStart>>, FactoryArgumentsBuilder__worker_builder>, __NumInitialWorkers: IntoSet<Option<usize>, FactoryArgumentsBuilder__num_initial_workers>, __Router: IntoSet<TRouter, FactoryArgumentsBuilder__router>, __Queue: IntoSet<TQueue, FactoryArgumentsBuilder__queue>, __DiscardHandler: IntoSet<Option<Arc<dyn DiscardHandler<TKey, TMsg>>>, FactoryArgumentsBuilder__discard_handler>, __DiscardSettings: IntoSet<Option<DiscardSettings>, FactoryArgumentsBuilder__discard_settings>, __DeadMansSwitch: IntoSet<Option<DeadMansSwitchConfiguration>, FactoryArgumentsBuilder__dead_mans_switch>, __CapacityController: IntoSet<Option<Box<dyn WorkerCapacityController>>, FactoryArgumentsBuilder__capacity_controller>, __LifecycleHooks: IntoSet<Option<Box<dyn FactoryLifecycleHooks<TKey, TMsg>>>, FactoryArgumentsBuilder__lifecycle_hooks>, __Stats: IntoSet<Option<Arc<dyn FactoryStatsLayer>>, FactoryArgumentsBuilder__stats>,

Finishes building and returns the requested object.

Source

pub fn worker_builder( self, value: Box<dyn WorkerBuilder<TWorker, TWorkerStart>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (Set<Box<dyn WorkerBuilder<TWorker, TWorkerStart>>>, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __WorkerBuilder: IsUnset,

The factory is responsible for spawning workers and re-spawning workers under failure scenarios. This means that it needs to understand how to build workers. The WorkerBuilder trait is used by the factory to construct new workers when needed.

Source

pub fn maybe_num_initial_workers( self, value: Option<usize>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, Set<Option<usize>>, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __NumInitialWorkers: IsUnset,

Same as Self::num_initial_workers, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn num_initial_workers( self, value: usize, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, Set<Option<usize>>, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __NumInitialWorkers: IsUnset,

Number of (initial) workers in the factory

Default = 1 worker

Source

pub fn router( self, value: TRouter, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, Set<TRouter>, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __Router: IsUnset,

Message routing handler

Source

pub fn queue( self, value: TQueue, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, Set<TQueue>, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __Queue: IsUnset,

Message queue implementation for the factory

Source

pub fn maybe_discard_handler( self, value: Option<Arc<dyn DiscardHandler<TKey, TMsg>>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, Set<Option<Arc<dyn DiscardHandler<TKey, TMsg>>>>, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __DiscardHandler: IsUnset,

Same as Self::discard_handler, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn discard_handler( self, value: Arc<dyn DiscardHandler<TKey, TMsg>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, Set<Option<Arc<dyn DiscardHandler<TKey, TMsg>>>>, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __DiscardHandler: IsUnset,

Discard callback when a job is discarded.

Default is None

Source

pub fn maybe_discard_settings( self, value: Option<DiscardSettings>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, Set<Option<DiscardSettings>>, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __DiscardSettings: IsUnset,

Same as Self::discard_settings, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn discard_settings( self, value: DiscardSettings, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, Set<Option<DiscardSettings>>, __DeadMansSwitch, __CapacityController, __LifecycleHooks, __Stats)>
where __DiscardSettings: IsUnset,

Maximum queue length. Any job arriving when the queue is at its max length will cause a job at the head or tail of the queue to be dropped (which is controlled by discard_mode).

  • For factories using routing protocols like routing::QueuerRouting, routing::StickyQueuerRouting routing, these are applied to the factory’s internal queue.
  • For all other routing non-factory-queueing protocols, this applies to the worker’s message queue

Default is DiscardSettings::None

Source

pub fn maybe_dead_mans_switch( self, value: Option<DeadMansSwitchConfiguration>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, Set<Option<DeadMansSwitchConfiguration>>, __CapacityController, __LifecycleHooks, __Stats)>
where __DeadMansSwitch: IsUnset,

Same as Self::dead_mans_switch, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn dead_mans_switch( self, value: DeadMansSwitchConfiguration, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, Set<Option<DeadMansSwitchConfiguration>>, __CapacityController, __LifecycleHooks, __Stats)>
where __DeadMansSwitch: IsUnset,

Controls the “dead man’s” switching logic on the factory. Periodically the factory will scan for stuck workers. If detected, the worker information will be logged along with the current job key information. Optionally the worker can be killed and replaced by the factory

Default is None

Source

pub fn maybe_capacity_controller( self, value: Option<Box<dyn WorkerCapacityController>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, Set<Option<Box<dyn WorkerCapacityController>>>, __LifecycleHooks, __Stats)>
where __CapacityController: IsUnset,

Same as Self::capacity_controller, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn capacity_controller( self, value: Box<dyn WorkerCapacityController>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, Set<Option<Box<dyn WorkerCapacityController>>>, __LifecycleHooks, __Stats)>
where __CapacityController: IsUnset,

Controls the parallel capacity of the worker pool by dynamically growing/shrinking the pool

Default is None

Source

pub fn maybe_lifecycle_hooks( self, value: Option<Box<dyn FactoryLifecycleHooks<TKey, TMsg>>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, Set<Option<Box<dyn FactoryLifecycleHooks<TKey, TMsg>>>>, __Stats)>
where __LifecycleHooks: IsUnset,

Same as Self::lifecycle_hooks, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn lifecycle_hooks( self, value: Box<dyn FactoryLifecycleHooks<TKey, TMsg>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, Set<Option<Box<dyn FactoryLifecycleHooks<TKey, TMsg>>>>, __Stats)>
where __LifecycleHooks: IsUnset,

Lifecycle hooks provide access to points in the factory’s lifecycle for shutdown/startup/draining where user-defined logic can execute (and block factory lifecycle at critical points). For example, this means the factory won’t start accepting requests until the complete startup routine is completed.

Default is None

Source

pub fn maybe_stats( self, value: Option<Arc<dyn FactoryStatsLayer>>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, Set<Option<Arc<dyn FactoryStatsLayer>>>)>
where __Stats: IsUnset,

Same as Self::stats, but accepts an Option as input. See that method’s documentation for more details.

Source

pub fn stats( self, value: Arc<dyn FactoryStatsLayer>, ) -> FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, (__WorkerBuilder, __NumInitialWorkers, __Router, __Queue, __DiscardHandler, __DiscardSettings, __DeadMansSwitch, __CapacityController, __LifecycleHooks, Set<Option<Arc<dyn FactoryStatsLayer>>>)>
where __Stats: IsUnset,

Defines the statistics collection layer for the factory. Useful for tracking factory properties.

Default is None

Auto Trait Implementations§

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State> Freeze for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>
where ___State: Freeze,

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State = (Unset<Required>, Unset<Optional>, Unset<Required>, Unset<Required>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>)> !RefUnwindSafe for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State> Send for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>
where ___State: Send,

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State> Sync for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>
where ___State: Sync, TRouter: Sync, TQueue: Sync, TMsg: Sync, TWorkerStart: Sync,

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State> Unpin for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>
where ___State: Unpin, TRouter: Unpin, TQueue: Unpin, TKey: Unpin, TMsg: Unpin, TWorkerStart: Unpin, TWorker: Unpin,

§

impl<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State = (Unset<Required>, Unset<Optional>, Unset<Required>, Unset<Required>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>, Unset<Optional>)> !UnwindSafe for FactoryArgumentsBuilder<TKey, TMsg, TWorkerStart, TWorker, TRouter, TQueue, ___State>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Message for T
where T: Any + Send + 'static,

Source§

fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>

Convert a BoxedMessage to this concrete type
Source§

fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>

Convert this message to a BoxedMessage
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> State for T
where T: Any + Send + 'static,