pub struct WorkerConfig {
pub worker_id: String,
pub server_name: String,
pub queues: Vec<String>,
pub concurrency: usize,
pub job_timeout: Duration,
pub polling_interval: Duration,
pub auto_retry: bool,
pub max_retries: u32,
}
Expand description
Configuration for worker instances
Fields§
§worker_id: String
Unique identifier for the worker
server_name: String
Name of the server where the worker is running
queues: Vec<String>
Queues that this worker will process
concurrency: usize
Maximum number of concurrent jobs this worker can handle
job_timeout: Duration
Timeout for job execution
polling_interval: Duration
Polling interval for checking new jobs
auto_retry: bool
Whether to automatically retry failed jobs
max_retries: u32
Maximum number of retry attempts
Implementations§
Source§impl WorkerConfig
impl WorkerConfig
Sourcepub fn new(worker_id: impl Into<String>) -> Self
pub fn new(worker_id: impl Into<String>) -> Self
Create a new worker configuration with the specified worker ID
Sourcepub fn server_name(self, server_name: impl Into<String>) -> Self
pub fn server_name(self, server_name: impl Into<String>) -> Self
Set the server name
Sourcepub fn concurrency(self, concurrency: usize) -> Self
pub fn concurrency(self, concurrency: usize) -> Self
Set the concurrency level
Sourcepub fn job_timeout(self, timeout: Duration) -> Self
pub fn job_timeout(self, timeout: Duration) -> Self
Set the job timeout
Sourcepub fn polling_interval(self, interval: Duration) -> Self
pub fn polling_interval(self, interval: Duration) -> Self
Set the polling interval
Sourcepub fn auto_retry(self, auto_retry: bool) -> Self
pub fn auto_retry(self, auto_retry: bool) -> Self
Set auto retry behavior
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set maximum retry attempts
Trait Implementations§
Source§impl Clone for WorkerConfig
impl Clone for WorkerConfig
Source§fn clone(&self) -> WorkerConfig
fn clone(&self) -> WorkerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WorkerConfig
impl Debug for WorkerConfig
Source§impl Default for WorkerConfig
impl Default for WorkerConfig
Source§impl<'de> Deserialize<'de> for WorkerConfig
impl<'de> Deserialize<'de> for WorkerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WorkerConfig
impl RefUnwindSafe for WorkerConfig
impl Send for WorkerConfig
impl Sync for WorkerConfig
impl Unpin for WorkerConfig
impl UnwindSafe for WorkerConfig
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