pub struct DlqRouter { /* private fields */ }Expand description
Tracks nack counts and routes dead-lettered messages.
Implementations§
Source§impl DlqRouter
impl DlqRouter
Sourcepub fn new(source_topic: &str, dlq_topic: &str, max_retries: u32) -> Self
pub fn new(source_topic: &str, dlq_topic: &str, max_retries: u32) -> Self
Create a new DLQ router.
dlq_topic is the name of the topic where dead-lettered messages are
sent. It must already exist in the TopicManager.
Sourcepub fn nack(&mut self, partition: u32, offset: u64) -> bool
pub fn nack(&mut self, partition: u32, offset: u64) -> bool
Record a negative acknowledgement for a message.
Returns true if the message should be routed to the DLQ (max retries
exceeded). The caller is responsible for calling DlqRouter::route_to_dlq with
the actual message bytes.
Sourcepub fn route_to_dlq(
&mut self,
mgr: &mut TopicManager,
partition: u32,
offset: u64,
value: &[u8],
) -> Result<u64>
pub fn route_to_dlq( &mut self, mgr: &mut TopicManager, partition: u32, offset: u64, value: &[u8], ) -> Result<u64>
Route a message to the DLQ topic.
Clears the nack counter for the given offset after routing.
Sourcepub fn nack_count(&self, partition: u32, offset: u64) -> u32
pub fn nack_count(&self, partition: u32, offset: u64) -> u32
Returns the current nack count for a message.
Sourcepub fn source_topic(&self) -> &str
pub fn source_topic(&self) -> &str
Returns the source topic name.
Sourcepub fn max_retries(&self) -> u32
pub fn max_retries(&self) -> u32
Returns the maximum retries setting.
Auto Trait Implementations§
impl Freeze for DlqRouter
impl RefUnwindSafe for DlqRouter
impl Send for DlqRouter
impl Sync for DlqRouter
impl Unpin for DlqRouter
impl UnwindSafe for DlqRouter
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