pub struct WorkerBuilder<'a, CONTEXT>{ /* private fields */ }Expand description
A builder object for a Worker.
Implementations§
Source§impl<'a, CONTEXT> WorkerBuilder<'a, CONTEXT>
impl<'a, CONTEXT> WorkerBuilder<'a, CONTEXT>
Sourcepub fn new(queue: &'a Queue, context: CONTEXT) -> Self
pub fn new(queue: &'a Queue, context: CONTEXT) -> Self
Create a new WorkerBuilder for a particular Queue.
Sourcepub fn registry(self, registry: &'a JobRegistry<CONTEXT>) -> Self
pub fn registry(self, registry: &'a JobRegistry<CONTEXT>) -> Self
Get the job definitions from this JobRegistry.
Sourcepub fn jobs(self, jobs: impl Into<Vec<JobRunner<CONTEXT>>>) -> Self
pub fn jobs(self, jobs: impl Into<Vec<JobRunner<CONTEXT>>>) -> Self
Get the job definitions from this list of JobRunners.
Sourcepub fn limit_job_types(self, job_types: &[impl AsRef<str>]) -> Self
pub fn limit_job_types(self, job_types: &[impl AsRef<str>]) -> Self
Limit this worker to only running these job types, even if the registry contains more types.
Sourcepub fn min_concurrency(self, min_concurrency: u16) -> Self
pub fn min_concurrency(self, min_concurrency: u16) -> Self
Set the minimum concurrency for this worker. When the number of running jobs falls below
this number, the worker will try to fetch more jobs, up to max_concurrency.
Defaults to the same as max_concurrency.
Sourcepub fn max_concurrency(self, max_concurrency: u16) -> Self
pub fn max_concurrency(self, max_concurrency: u16) -> Self
The maximum number of jobs that the worker will run concurrently. Defaults to 1.
Auto Trait Implementations§
impl<'a, CONTEXT> Freeze for WorkerBuilder<'a, CONTEXT>where
CONTEXT: Freeze,
impl<'a, CONTEXT> !RefUnwindSafe for WorkerBuilder<'a, CONTEXT>
impl<'a, CONTEXT> Send for WorkerBuilder<'a, CONTEXT>
impl<'a, CONTEXT> Sync for WorkerBuilder<'a, CONTEXT>
impl<'a, CONTEXT> Unpin for WorkerBuilder<'a, CONTEXT>where
CONTEXT: Unpin,
impl<'a, CONTEXT> !UnwindSafe for WorkerBuilder<'a, CONTEXT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more