pub struct RedeliveryPolicy {
pub max_attempts: u32,
pub initial_delay: Duration,
pub multiplier: f64,
pub max_delay: Duration,
pub jitter_factor: f64,
}Expand description
Redelivery policy with exponential backoff and optional jitter.
Fields§
§max_attempts: u32§initial_delay: Duration§multiplier: f64§max_delay: Duration§jitter_factor: f64Implementations§
Source§impl RedeliveryPolicy
impl RedeliveryPolicy
Sourcepub fn new(max_attempts: u32) -> Self
pub fn new(max_attempts: u32) -> Self
Create a new policy with default delays (100ms initial, 2x multiplier, 10s max, no jitter).
Note: max_attempts = 0 means no retries (immediate failure to DLC/handler).
Use max_attempts > 0 to enable retry behavior.
Sourcepub fn with_initial_delay(self, d: Duration) -> Self
pub fn with_initial_delay(self, d: Duration) -> Self
Override the initial delay before the first retry.
Sourcepub fn with_multiplier(self, m: f64) -> Self
pub fn with_multiplier(self, m: f64) -> Self
Override the backoff multiplier applied after each attempt.
Sourcepub fn with_max_delay(self, d: Duration) -> Self
pub fn with_max_delay(self, d: Duration) -> Self
Cap the maximum delay between retries.
Sourcepub fn with_jitter(self, j: f64) -> Self
pub fn with_jitter(self, j: f64) -> Self
Set jitter factor (0.0 = no jitter, 0.2 = ±20% randomization).
Recommended values: 0.1-0.3 (10-30%) for most use cases. Helps prevent thundering herd problems in distributed systems by adding randomization to retry timing.
Trait Implementations§
Source§impl Clone for RedeliveryPolicy
impl Clone for RedeliveryPolicy
Source§fn clone(&self) -> RedeliveryPolicy
fn clone(&self) -> RedeliveryPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RedeliveryPolicy
impl RefUnwindSafe for RedeliveryPolicy
impl Send for RedeliveryPolicy
impl Sync for RedeliveryPolicy
impl Unpin for RedeliveryPolicy
impl UnsafeUnpin for RedeliveryPolicy
impl UnwindSafe for RedeliveryPolicy
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
Mutably borrows from an owned value. Read more