#[non_exhaustive]pub enum Delay {
DlxTtl {
waiting_queue: Option<String>,
},
DelayedMessageExchange {
exchange: Option<String>,
},
}Expand description
How a subscription handles retry_after / nack_after delays.
Passed to RabbitQueue::delay. There is no default that enables
it: a waiting queue or delayed exchange is infrastructure the user owns, so opting in is
explicit.
§Examples
use ruststream_lapin::{Delay, RabbitQueue};
// Waiting queue named `orders.retry` (the default derived from the origin queue):
let orders = RabbitQueue::new("orders").delay(Delay::dlx_ttl());
// Or an explicit waiting-queue name:
let named = RabbitQueue::new("orders").delay(Delay::dlx_ttl_named("orders.wait"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DlxTtl
Route delayed redeliveries through a TTL waiting queue whose dead-letter target is the origin queue.
§Classic-queue caveat
A classic queue releases expired messages only from its head, so a short-TTL message stuck
behind a long-TTL one waits for the long one. Use one waiting queue per delay class (or a
quorum queue, which does not have this head-of-line constraint) when delays vary widely, or
switch to plugin_dme, which has no head-of-line constraint.
DelayedMessageExchange
Route delayed redeliveries through the
rabbitmq_delayed_message_exchange
plugin: the message is re-published to an x-delayed-message exchange with an x-delay
header, and the plugin releases it to the origin queue after the delay. Unlike the classic
waiting queue, mixed delays do not block each other. Requires the plugin on the broker, so
it is behind the plugin-dme feature.
Implementations§
Source§impl Delay
impl Delay
Sourcepub fn dlx_ttl_named(name: impl Into<String>) -> Self
pub fn dlx_ttl_named(name: impl Into<String>) -> Self
A TTL waiting queue with an explicit name.
Sourcepub const fn plugin_dme() -> Self
pub const fn plugin_dme() -> Self
A delayed-message-exchange named <origin>.delay.
Sourcepub fn plugin_dme_named(name: impl Into<String>) -> Self
pub fn plugin_dme_named(name: impl Into<String>) -> Self
A delayed-message-exchange with an explicit name (share one across queues if you like).