#[non_exhaustive]pub struct DispatchConfig {
pub worker_id: String,
pub batch_size: usize,
pub send_timeout: Duration,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: u32,
pub max_attempts: u32,
}Expand description
How the dispatcher works (all of it optional, all of it conservative).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.worker_id: StringIdentifier this dispatcher claims rows under. Distinct per process.
batch_size: usizeRows claimed per OutboxDispatcher::run_once.
send_timeout: DurationDeadline for one OutboxSender::send. Exceeding it is an unknown
outcome, not a retry.
initial_backoff: DurationDelay before the second attempt of a row.
max_backoff: DurationCeiling on the computed delay.
backoff_multiplier: u32Multiplier applied per further attempt.
max_attempts: u32Attempts a row gets before a retryable failure becomes a permanent one.
Implementations§
Source§impl DispatchConfig
impl DispatchConfig
Sourcepub fn new(worker_id: impl Into<String>) -> Self
pub fn new(worker_id: impl Into<String>) -> Self
Sixteen rows a sweep, thirty seconds a send, one second of backoff growing by four up to a minute, five attempts.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Returns a copy claiming at most batch_size rows a sweep.
Sourcepub const fn with_send_timeout(self, send_timeout: Duration) -> Self
pub const fn with_send_timeout(self, send_timeout: Duration) -> Self
Returns a copy with another send deadline.
Sourcepub const fn with_max_attempts(self, max_attempts: u32) -> Self
pub const fn with_max_attempts(self, max_attempts: u32) -> Self
Returns a copy with another attempt budget.
Sourcepub const fn with_backoff(self, initial: Duration, max: Duration) -> Self
pub const fn with_backoff(self, initial: Duration, max: Duration) -> Self
Returns a copy with another backoff schedule.
Sourcepub fn backoff_for(&self, attempt: u32) -> Duration
pub fn backoff_for(&self, attempt: u32) -> Duration
The delay before attempt number attempt, 1-based.
Trait Implementations§
Source§impl Clone for DispatchConfig
impl Clone for DispatchConfig
Source§impl Debug for DispatchConfig
impl Debug for DispatchConfig
impl Eq for DispatchConfig
Source§impl PartialEq for DispatchConfig
impl PartialEq for DispatchConfig
impl StructuralPartialEq for DispatchConfig
Auto Trait Implementations§
impl Freeze for DispatchConfig
impl RefUnwindSafe for DispatchConfig
impl Send for DispatchConfig
impl Sync for DispatchConfig
impl Unpin for DispatchConfig
impl UnsafeUnpin for DispatchConfig
impl UnwindSafe for DispatchConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.