pub struct DeadLetterQueue { /* private fields */ }Expand description
In-memory dead letter queue for failed handler events.
Thread-safe — uses internal Mutex. For production, back with a database table.
Implementations§
Source§impl DeadLetterQueue
impl DeadLetterQueue
Sourcepub fn push(
&self,
event: DecodedEvent,
handler_name: impl Into<String>,
error_message: impl Into<String>,
)
pub fn push( &self, event: DecodedEvent, handler_name: impl Into<String>, error_message: impl Into<String>, )
Push a failed event into the DLQ.
The entry is scheduled for retry based on the configured backoff.
Sourcepub fn pop_ready(&self, now: i64) -> Vec<DlqEntry>
pub fn pop_ready(&self, now: i64) -> Vec<DlqEntry>
Pop all entries that are due for retry (next_retry_at <= now).
Returns entries with status set to Retrying.
Sourcepub fn mark_success(&self, id: &str)
pub fn mark_success(&self, id: &str)
Mark an entry as successfully retried (removes it from the DLQ).
Sourcepub fn mark_failed(&self, id: &str, error_message: impl Into<String>)
pub fn mark_failed(&self, id: &str, error_message: impl Into<String>)
Mark an entry as failed again (reschedule or permanently fail).
Sourcepub fn get_by_status(&self, status: DlqStatus) -> Vec<DlqEntry>
pub fn get_by_status(&self, status: DlqStatus) -> Vec<DlqEntry>
Get all entries with a specific status.
Sourcepub fn purge_before(&self, timestamp: i64) -> usize
pub fn purge_before(&self, timestamp: i64) -> usize
Purge (remove) all entries with last_failed_at before the given timestamp.
Sourcepub fn retry_all_failed(&self) -> usize
pub fn retry_all_failed(&self) -> usize
Reset all Failed entries to Pending for another round of retries.
Trait Implementations§
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
Mutably borrows from an owned value. Read more