pub struct JobBuilder { /* private fields */ }
Expand description
Builder for spawning a job. By default, ordered
mode is off and infinite
retries with capped exponential backoff is used (1 second initially,
maximum 1 hour between tries).
Implementations§
Source§impl JobBuilder
impl JobBuilder
Sourcepub fn new(name: &'static str) -> Self
pub fn new(name: &'static str) -> Self
Create new JobBuilder
. By default, ordered
mode is off and
infinite retries with capped exponential backoff is used (1 second
initially, maximum 1 hour between tries).
Sourcepub fn id(self, id: u128) -> Self
pub fn id(self, id: u128) -> Self
Set the message’s ID. If not set, a new random one will be generated.
Sourcepub fn ordered(self, ordered: bool) -> Self
pub fn ordered(self, ordered: bool) -> Self
Set whether ordered mode should be used. Ordered messages can only be executed after the previous ordered message, but unordered messages caan always be executed independently.
Sourcepub fn max_executions(self, max_executions: impl Into<Option<u32>>) -> Self
pub fn max_executions(self, max_executions: impl Into<Option<u32>>) -> Self
Set the maximum number of executions. None = infinite retrying. Zero executions will result in the job never being executed!
Sourcepub fn retry_timing(self, timing: RetryTiming) -> Self
pub fn retry_timing(self, timing: RetryTiming) -> Self
Set the retry timing strategy. See RetryTiming
for the possible
values.
Sourcepub fn payload_json<S: Serialize>(self, payload: S) -> Result<Self, Error>
pub fn payload_json<S: Serialize>(self, payload: S) -> Result<Self, Error>
Set JSON payload. If not set, there will be no JSON input to the job, but there can still be byte data. The payloads are independent.
Sourcepub fn payload_bytes(self, payload: Vec<u8>) -> Self
pub fn payload_bytes(self, payload: Vec<u8>) -> Self
Set byte payload. If not set, there will be no byte input to the job, but there can still be JSON data. The payloads are independent.
Sourcepub async fn spawn<DB>(self, db: &DB) -> Result<u128, Error>where
DB: AsyncConnection + AsyncPubSub,
pub async fn spawn<DB>(self, db: &DB) -> Result<u128, Error>where
DB: AsyncConnection + AsyncPubSub,
Spawn the job into the message queue on the database.
Trait Implementations§
Source§impl Clone for JobBuilder
impl Clone for JobBuilder
Source§fn clone(&self) -> JobBuilder
fn clone(&self) -> JobBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for JobBuilder
impl RefUnwindSafe for JobBuilder
impl Send for JobBuilder
impl Sync for JobBuilder
impl Unpin for JobBuilder
impl UnwindSafe for JobBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more