pub struct DeadLetterQueue { /* private fields */ }Expand description
A bounded dead letter queue.
Implementations§
Source§impl DeadLetterQueue
impl DeadLetterQueue
Sourcepub fn push(&mut self, letter: DeadLetter) -> Result<(), DlqError>
pub fn push(&mut self, letter: DeadLetter) -> Result<(), DlqError>
Push a dead letter into the queue.
Returns DlqError::QueueFull if the queue has reached max_size.
Sourcepub fn pop(&mut self) -> Option<DeadLetter>
pub fn pop(&mut self) -> Option<DeadLetter>
Remove and return the oldest dead letter (FIFO).
Sourcepub fn peek(&self) -> Option<&DeadLetter>
pub fn peek(&self) -> Option<&DeadLetter>
Peek at the oldest dead letter without removing it.
Sourcepub fn total_received(&self) -> u64
pub fn total_received(&self) -> u64
Total number of dead letters ever pushed into this queue (including ones that were later popped or purged).
Sourcepub fn purge_expired(&mut self, current_time_ms: u64) -> usize
pub fn purge_expired(&mut self, current_time_ms: u64) -> usize
Remove entries whose last_failed_at is older than max_age_ms
relative to current_time_ms.
Returns the number of entries removed.
Sourcepub fn find_by_topic(&self, topic: &str) -> Vec<&DeadLetter>
pub fn find_by_topic(&self, topic: &str) -> Vec<&DeadLetter>
Return references to all entries whose original_topic equals topic.
Sourcepub fn replay(
&mut self,
message_id: &str,
) -> Result<Option<DeadLetter>, DlqError>
pub fn replay( &mut self, message_id: &str, ) -> Result<Option<DeadLetter>, DlqError>
If enable_replay is true, remove the entry with the given
message_id and return it for re-processing.
Returns None if no matching entry exists.
Returns Err(DlqError::ReplayDisabled) if replay is turned off.
Sourcepub fn group_by_reason(&self) -> HashMap<String, usize>
pub fn group_by_reason(&self) -> HashMap<String, usize>
Group entries by their failure reason label and return a map of
label → count.
Auto Trait Implementations§
impl Freeze for DeadLetterQueue
impl RefUnwindSafe for DeadLetterQueue
impl Send for DeadLetterQueue
impl Sync for DeadLetterQueue
impl Unpin for DeadLetterQueue
impl UnsafeUnpin for DeadLetterQueue
impl UnwindSafe for DeadLetterQueue
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.