pub struct DeadLetterQueueBackend { /* private fields */ }Expand description
A backend wrapper that forwards failed messages to a dead letter queue.
This wraps an existing MessageBackend and provides methods to send messages with failure context to a dedicated DLQ queue/exchange.
Implementations§
Source§impl DeadLetterQueueBackend
impl DeadLetterQueueBackend
Sourcepub fn new(backend: Arc<dyn MessageBackend>, dlq_name: &str) -> Self
pub fn new(backend: Arc<dyn MessageBackend>, dlq_name: &str) -> Self
Create a new DLQ backend wrapper.
§Arguments
backend- The backend to use for sending DLQ messages (e.g., RabbitMQ DLQ queue)dlq_name- Name identifier for this DLQ (used in logs/metrics)
Sourcepub async fn send_to_dlq(
&self,
dlq_message: &DeadLetterMessage,
) -> WorkerResult<()>
pub async fn send_to_dlq( &self, dlq_message: &DeadLetterMessage, ) -> WorkerResult<()>
Send a message to the dead letter queue with failure context.
This method serializes the DLQ message and sends it to the configured backend (e.g., RabbitMQ DLQ queue, Redis stream, etc.).
§Arguments
dlq_message- The dead letter message containing original payload and failure info
§Returns
Ok if successfully sent to DLQ, Err if DLQ operation failed
Sourcepub fn backend(&self) -> &Arc<dyn MessageBackend>
pub fn backend(&self) -> &Arc<dyn MessageBackend>
Get a reference to the underlying backend.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DeadLetterQueueBackend
impl !UnwindSafe for DeadLetterQueueBackend
impl Freeze for DeadLetterQueueBackend
impl Send for DeadLetterQueueBackend
impl Sync for DeadLetterQueueBackend
impl Unpin for DeadLetterQueueBackend
impl UnsafeUnpin for DeadLetterQueueBackend
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