pub struct DeadLetterQueue { /* private fields */ }Expand description
Queue for messages that could not be delivered.
Bounded FIFO queue: when full, the oldest entry is evicted. Queryable by target PID, reason variant, and time range.
When an optional ChainManager is
attached, every intake is recorded as an ipc.dead_letter event
in the ExoChain audit trail.
Implementations§
Source§impl DeadLetterQueue
impl DeadLetterQueue
Sourcepub fn with_default_capacity() -> Self
pub fn with_default_capacity() -> Self
Create a dead letter queue with the default capacity (10,000).
Sourcepub fn with_chain(self, cm: Arc<ChainManager>) -> Self
pub fn with_chain(self, cm: Arc<ChainManager>) -> Self
Attach a chain manager for audit logging (builder pattern).
When set, every intake call emits an ipc.dead_letter event
to the ExoChain.
Sourcepub fn intake(&self, message: KernelMessage, reason: DeadLetterReason)
pub fn intake(&self, message: KernelMessage, reason: DeadLetterReason)
Intake a message that could not be delivered.
If the queue is at capacity, the oldest entry is evicted (FIFO).
When a ChainManager is attached,
the dead letter is recorded as an ipc.dead_letter chain event.
Sourcepub fn query_by_target(&self, pid: Pid) -> Vec<DeadLetter>
pub fn query_by_target(&self, pid: Pid) -> Vec<DeadLetter>
Query dead letters by target PID.
Sourcepub fn query_by_reason(&self, reason_name: &str) -> Vec<DeadLetter>
pub fn query_by_reason(&self, reason_name: &str) -> Vec<DeadLetter>
Query dead letters by reason variant name.
Sourcepub fn query_by_time_range(
&self,
since: DateTime<Utc>,
until: DateTime<Utc>,
) -> Vec<DeadLetter>
pub fn query_by_time_range( &self, since: DateTime<Utc>, until: DateTime<Utc>, ) -> Vec<DeadLetter>
Query dead letters within a time range (inclusive).
Sourcepub fn take_for_retry(&self, msg_id: &str) -> Option<DeadLetter>
pub fn take_for_retry(&self, msg_id: &str) -> Option<DeadLetter>
Remove and return a dead letter by message ID for retry.
The retry_count on the returned letter is incremented.
Sourcepub fn re_add(&self, letter: DeadLetter)
pub fn re_add(&self, letter: DeadLetter)
Re-add a letter that failed retry back into the queue.
Sourcepub fn snapshot(&self) -> Vec<DeadLetter>
pub fn snapshot(&self) -> Vec<DeadLetter>
Get all dead letters (snapshot).
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 more