Struct faktory::Job

source ·
pub struct Job {
    pub queue: String,
    pub created_at: Option<DateTime<Utc>>,
    pub enqueued_at: Option<DateTime<Utc>>,
    pub at: Option<DateTime<Utc>>,
    pub reserve_for: Option<usize>,
    pub retry: Option<usize>,
    pub priority: Option<u8>,
    pub backtrace: Option<usize>,
    pub custom: HashMap<String, Value>,
    /* private fields */
}
Expand description

A Faktory job.

See also the Faktory wiki.

Fields§

§queue: String

The queue this job belongs to. Usually default.

§created_at: Option<DateTime<Utc>>

When this job was created.

§enqueued_at: Option<DateTime<Utc>>

When this job was supplied to the Faktory server.

§at: Option<DateTime<Utc>>

When this job is scheduled for.

Defaults to immediately.

§reserve_for: Option<usize>

How long to allow this job to run for.

Defaults to 600 seconds.

§retry: Option<usize>

Number of times to retry this job.

Defaults to 25.

§priority: Option<u8>

The priority of this job from 1-9 (9 is highest).

Pushing a job with priority 9 will effectively put it at the front of the queue. Defaults to 5.

§backtrace: Option<usize>

Number of lines of backtrace to keep if this job fails.

Defaults to 0.

§custom: HashMap<String, Value>

Extra context to include with the job.

Faktory workers can have plugins and middleware which need to store additional context with the job payload. Faktory supports a custom hash to store arbitrary key/values in the JSON. This can be extremely helpful for cross-cutting concerns which should propagate between systems, e.g. locale for user-specific text translations, request_id for tracing execution across a complex distributed system, etc.

Implementations§

Create a new job of type kind, with the given arguments.

Place this job on the given queue.

If this method is not called (or self.queue set otherwise), the queue will be set to “default”.

This job’s id.

This job’s type.

The arguments provided for this job.

Trait Implementations§

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.