pub struct JobContext {
pub job_id: Uuid,
pub job_type: &'static str,
pub queue: &'static str,
pub attempt: u32,
pub max_attempts: u32,
pub deferrals: u32,
pub priority: u8,
pub age: Duration,
}Expand description
Metadata about the current execution, available to handlers.
Fields§
§job_id: UuidStable id of the job, unchanged across retries.
job_type: &'static strJob::NAME of the running job.
queue: &'static strBroker queue name the job was consumed from.
attempt: u321-based.
max_attempts: u32Total attempts the effective retry policy allows.
deferrals: u32How often this job was deferred (see crate::JobError::Deferred).
Independent of attempt. There is no built-in cap: a handler that wants one
checks this and returns crate::JobError::Fatal instead of deferring again.
priority: u8Broker message priority this delivery arrived with; 0 is normal work.
age: DurationTime since first enqueue.
Implementations§
Source§impl JobContext
impl JobContext
Sourcepub fn is_last_attempt(&self) -> bool
pub fn is_last_attempt(&self) -> bool
Whether a failure now means the job is dead-lettered.
Trait Implementations§
Source§impl Clone for JobContext
impl Clone for JobContext
Source§fn clone(&self) -> JobContext
fn clone(&self) -> JobContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for JobContext
impl RefUnwindSafe for JobContext
impl Send for JobContext
impl Sync for JobContext
impl Unpin for JobContext
impl UnsafeUnpin for JobContext
impl UnwindSafe for JobContext
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