pub struct ReliableQueue { /* private fields */ }Expand description
Reliable message delivery with acknowledgment tracking.
Tracks pending deliveries by correlation ID. On ack timeout, retries
with exponential backoff. After max_retries, routes to the
dead letter queue.
Implementations§
Source§impl ReliableQueue
impl ReliableQueue
Sourcepub fn new(
config: ReliableConfig,
dead_letter: Arc<DeadLetterQueue>,
) -> ReliableQueue
pub fn new( config: ReliableConfig, dead_letter: Arc<DeadLetterQueue>, ) -> ReliableQueue
Create a new reliable queue with the given config and dead letter queue.
Sourcepub fn with_defaults(dead_letter: Arc<DeadLetterQueue>) -> ReliableQueue
pub fn with_defaults(dead_letter: Arc<DeadLetterQueue>) -> ReliableQueue
Create with default configuration.
Sourcepub fn config(&self) -> &ReliableConfig
pub fn config(&self) -> &ReliableConfig
Get the configuration.
Sourcepub fn register(&self, msg: KernelMessage) -> (String, KernelMessage)
pub fn register(&self, msg: KernelMessage) -> (String, KernelMessage)
Register a message for reliable delivery tracking.
The message must have a correlation_id set. If not, one is
generated. Returns the correlation ID used for tracking.
Sourcepub fn acknowledge(&self, correlation_id: &str) -> Option<DeliveryResult>
pub fn acknowledge(&self, correlation_id: &str) -> Option<DeliveryResult>
Acknowledge receipt of a message by correlation ID.
Returns Some(DeliveryResult::Acknowledged) if the message was
pending, or None if not found (already acked or expired).
Sourcepub fn check_timeouts(&self) -> Vec<(String, KernelMessage)>
pub fn check_timeouts(&self) -> Vec<(String, KernelMessage)>
Check for timed-out deliveries and return messages needing retry.
Returns a list of (correlation_id, message) pairs that have
exceeded their ack deadline and should be retried.
Sourcepub fn expire_max_retries(&self) -> Vec<DeliveryResult>
pub fn expire_max_retries(&self) -> Vec<DeliveryResult>
Move deliveries that have exceeded max retries to the dead letter queue.
Returns the list of message IDs that were dead-lettered.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of currently pending deliveries.
Sourcepub fn is_pending(&self, correlation_id: &str) -> bool
pub fn is_pending(&self, correlation_id: &str) -> bool
Check if a specific correlation ID is pending.
Sourcepub fn pending_snapshot(&self) -> Vec<(String, PendingDelivery)>
pub fn pending_snapshot(&self) -> Vec<(String, PendingDelivery)>
Get a snapshot of all pending deliveries.
Sourcepub fn cancel(&self, correlation_id: &str) -> Option<KernelMessage>
pub fn cancel(&self, correlation_id: &str) -> Option<KernelMessage>
Cancel tracking for a specific message.
Sourcepub fn timeout_for_attempt(&self, attempt: u32) -> Duration
pub fn timeout_for_attempt(&self, attempt: u32) -> Duration
Calculate the timeout for a given attempt number.
Auto Trait Implementations§
impl Freeze for ReliableQueue
impl !RefUnwindSafe for ReliableQueue
impl Send for ReliableQueue
impl Sync for ReliableQueue
impl Unpin for ReliableQueue
impl UnsafeUnpin for ReliableQueue
impl UnwindSafe for ReliableQueue
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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