pub struct Job {
pub job_type: Cow<'static, str>,
pub priority: i32,
pub weight: u32,
pub run_at: Option<OffsetDateTime>,
pub payload: Vec<u8>,
pub retries: Retries,
pub timeout: Duration,
pub heartbeat_increment: Duration,
}Expand description
A job to be submitted to the queue.
Fields
job_type: Cow<'static, str>The name of the job, which matches the name used in the JobRunner for the job.
priority: i32Jobs with higher priority will be executed first.
weight: u32Jobs that are expected to take more processing resources can be given a higher weight
to account for this. A worker counts the job’s weight (1, by default) against its
maximum concurrency when deciding how many jobs it can execute. For example,
a worker with a max_concurrency of 10 would run three jobs at a time if each
had a weight of three.
For example, a video transcoding task might alter the weight depending on the resolution of the video or the processing requirements of the codec for each run.
run_at: Option<OffsetDateTime>When to run the job. None means to run it right away.
payload: Vec<u8>The payload to pass to the job when it runs.
retries: RetriesRetry behavior when the job fails.
timeout: DurationHow long to allow the job to run before it is considered failed.
heartbeat_increment: DurationHow much extra time a heartbeat will add to the expiration time.
Implementations
sourceimpl Job
impl Job
sourcepub fn builder(job_type: impl Into<Cow<'static, str>>) -> JobBuilder
pub fn builder(job_type: impl Into<Cow<'static, str>>) -> JobBuilder
Create a JobBuilder for the given job_type.