Skip to main content

ClaimerBuilder

Struct ClaimerBuilder 

Source
pub struct ClaimerBuilder<I: Job, DE, DF, DFut>
where DF: Fn(I, usize) -> DFut + 'static + Send + Sync, DE: Display + Send + 'static, DFut: Future<Output = Result<(), DE>> + Send,
{ /* private fields */ }
Expand description

Builder for constructing a Claimer.

Construct via ClaimerBuilder::new() and configure with chained setters:

let claimer = ClaimerBuilder::new()
    .min_idle_time(30_000)
    .max_retries(3)
    .dlq_worker(|payload: &Email, attempts| async move {
        Ok::<(), String>(())
    });

Implementations§

Source§

impl<I> ClaimerBuilder<I, NoDlqError, NoDlqFn<I>, NoDlqFut>
where I: Job,

Source

pub fn new() -> Self

Construct a new ClaimerBuilder with sensible defaults.

Defaults: min_idle_time = 30_000, block_timeout = 10_000, max_concurrent_tasks = 1, max_retries = 3, no DLQ worker.

Source§

impl<I, DE, DF, DFut> ClaimerBuilder<I, DE, DF, DFut>
where I: Job, DF: Fn(I, usize) -> DFut + 'static + Send + Sync, DE: Display + Send + 'static, DFut: Future<Output = Result<(), DE>> + Send,

Source

pub fn min_idle_time(self, ms: usize) -> Self

Minimum idle time (ms) before a message is eligible for reclaiming.

Source

pub fn block_timeout(self, ms: usize) -> Self

How long (ms) the claimer sleeps when there are no claimable messages.

Source

pub fn max_concurrent_tasks(self, n: usize) -> Self

Maximum messages reclaimed concurrently.

Source

pub fn max_retries(self, n: usize) -> Self

Delivery attempts before a message is sent to the DLQ.

Source

pub fn dlq_worker<DE2, DF2, DFut2>( self, worker: DF2, ) -> ClaimerBuilder<I, DE2, DF2, DFut2>
where DF2: Fn(I, usize) -> DFut2 + 'static + Send + Sync, DE2: Display + Send + 'static, DFut2: Future<Output = Result<(), DE2>> + Send,

Attach a dead-letter callback.

Changes the builder’s generic parameters to match the worker’s signature.

Trait Implementations§

Source§

impl<I> Default for ClaimerBuilder<I, NoDlqError, NoDlqFn<I>, NoDlqFut>
where I: Job,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I, DE, DF, DFut> Freeze for ClaimerBuilder<I, DE, DF, DFut>

§

impl<I, DE, DF, DFut> RefUnwindSafe for ClaimerBuilder<I, DE, DF, DFut>

§

impl<I, DE, DF, DFut> Send for ClaimerBuilder<I, DE, DF, DFut>
where I: Send,

§

impl<I, DE, DF, DFut> Sync for ClaimerBuilder<I, DE, DF, DFut>
where I: Sync, DE: Sync, DFut: Sync,

§

impl<I, DE, DF, DFut> Unpin for ClaimerBuilder<I, DE, DF, DFut>
where I: Unpin, DE: Unpin, DFut: Unpin,

§

impl<I, DE, DF, DFut> UnsafeUnpin for ClaimerBuilder<I, DE, DF, DFut>

§

impl<I, DE, DF, DFut> UnwindSafe for ClaimerBuilder<I, DE, DF, DFut>
where DF: RefUnwindSafe, I: UnwindSafe, DE: UnwindSafe, DFut: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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.

Source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.