Struct sqlxmq::JobBuilder

source ·
pub struct JobBuilder<'a> { /* private fields */ }
Expand description

Type for building a job to send.

Implementations§

source§

impl<'a> JobBuilder<'a>

source

pub fn new(name: &'a str) -> Self

Prepare to send a job with the specified name.

source

pub fn new_with_id(id: Uuid, name: &'a str) -> Self

Prepare to send a job with the specified name and ID.

source

pub fn set_proto<'b>( &'b mut self, proto: impl FnOnce(&'b mut Self) -> &'b mut Self ) -> &'b mut Self

Use the provided function to set any number of configuration options at once.

source

pub fn set_channel_name(&mut self, channel_name: &'a str) -> &mut Self

Set the channel name (default “”).

source

pub fn set_channel_args(&mut self, channel_args: &'a str) -> &mut Self

Set the channel arguments (default “”).

source

pub fn set_retries(&mut self, retries: u32) -> &mut Self

Set the number of retries after the initial attempt (default 4).

source

pub fn set_retry_backoff(&mut self, retry_backoff: Duration) -> &mut Self

Set the initial backoff for retries (default 1s).

source

pub fn set_commit_interval( &mut self, commit_interval: Option<Duration> ) -> &mut Self

Set the commit interval for two-phase commit (default disabled).

source

pub fn set_ordered(&mut self, ordered: bool) -> &mut Self

Set whether this job is strictly ordered with respect to other ordered job in the same channel (default false).

source

pub fn set_delay(&mut self, delay: Duration) -> &mut Self

Set a delay before this job is executed (default none).

source

pub fn set_raw_json(&mut self, raw_json: &'a str) -> &mut Self

Set a raw JSON payload for the job.

source

pub fn set_raw_bytes(&mut self, raw_bytes: &'a [u8]) -> &mut Self

Set a raw binary payload for the job.

source

pub fn set_json<T: ?Sized + Serialize>( &mut self, value: &T ) -> Result<&mut Self, Error>

Set a JSON payload for the job.

source

pub async fn spawn<'b, E: Executor<'b, Database = Postgres>>( &self, executor: E ) -> Result<Uuid, Error>

Spawn the job using the given executor. This might be a connection pool, a connection, or a transaction.

Trait Implementations§

source§

impl<'a> Clone for JobBuilder<'a>

source§

fn clone(&self) -> JobBuilder<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for JobBuilder<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for JobBuilder<'a>

§

impl<'a> Send for JobBuilder<'a>

§

impl<'a> Sync for JobBuilder<'a>

§

impl<'a> Unpin for JobBuilder<'a>

§

impl<'a> UnwindSafe for JobBuilder<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> Any for Twhere T: Any,

source§

impl<T> CloneAny for Twhere T: Any + Clone,

source§

impl<T> CloneAnySend for Twhere T: Any + Send + Clone,

source§

impl<T> CloneAnySendSync for Twhere T: Any + Send + Sync + Clone,

source§

impl<T> CloneAnySync for Twhere T: Any + Sync + Clone,