pub struct RabbitQueue { /* private fields */ }Expand description
Describes one queue subscription: the queue, its expected settings, and its bindings.
Descriptors describe the EXPECTED topology for routing; by default nothing is created on the
broker (managing infrastructure is the user’s job). Opt in to declaration per broker with
declare_topology(true).
§Examples
use ruststream_lapin::{QueueType, RabbitExchange, RabbitQueue};
let orders = RabbitQueue::new("orders")
.queue_type(QueueType::Quorum)
.bind(RabbitExchange::topic("events"), "order.*")
.dead_letter_exchange("dead-letters");
assert_eq!(orders.name(), "orders");Implementations§
Source§impl RabbitQueue
impl RabbitQueue
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Describes the queue name with the defaults: durable, shared, not auto-deleted.
Sourcepub fn durable(self, durable: bool) -> Self
pub fn durable(self, durable: bool) -> Self
Whether the queue survives a broker restart. Defaults to true.
Sourcepub fn exclusive(self, exclusive: bool) -> Self
pub fn exclusive(self, exclusive: bool) -> Self
Whether the queue is exclusive to this connection. Defaults to false.
Sourcepub fn auto_delete(self, auto_delete: bool) -> Self
pub fn auto_delete(self, auto_delete: bool) -> Self
Whether the queue is deleted when its last consumer disconnects. Defaults to false.
Sourcepub fn queue_type(self, queue_type: QueueType) -> Self
pub fn queue_type(self, queue_type: QueueType) -> Self
The queue type to declare, overriding the broker-wide
default_queue_type.
When neither is set no x-queue-type argument is sent and the server default applies.
Sourcepub fn bind(
self,
exchange: RabbitExchange,
routing_key: impl Into<String>,
) -> Self
pub fn bind( self, exchange: RabbitExchange, routing_key: impl Into<String>, ) -> Self
Binds the queue to exchange under routing_key.
Call repeatedly for multiple bindings. Without any binding the queue only receives messages published to the default exchange under the queue name.
Sourcepub fn dead_letter_exchange(self, exchange: impl Into<String>) -> Self
pub fn dead_letter_exchange(self, exchange: impl Into<String>) -> Self
Dead-letters rejected messages to exchange (the x-dead-letter-exchange argument).
A handler returning drop settles with basic.reject(requeue = false), which routes the
message there.
Sourcepub fn dead_letter_routing_key(self, routing_key: impl Into<String>) -> Self
pub fn dead_letter_routing_key(self, routing_key: impl Into<String>) -> Self
Overrides the routing key dead-lettered messages carry (x-dead-letter-routing-key).
Sourcepub fn argument(self, name: impl Into<String>, value: AMQPValue) -> Self
pub fn argument(self, name: impl Into<String>, value: AMQPValue) -> Self
Sets one raw declaration argument (x-...), passed through verbatim.
§Panics
Panics if name exceeds 255 bytes (the AMQP short-string limit); argument names are
compile-time constants in practice.
Sourcepub fn arguments(self, arguments: FieldTable) -> Self
pub fn arguments(self, arguments: FieldTable) -> Self
Replaces the whole raw declaration argument table (x-... passthrough).
Sourcepub fn prefetch(self, prefetch: u16) -> Self
pub fn prefetch(self, prefetch: u16) -> Self
Caps unacknowledged deliveries in flight for this subscription (basic.qos),
overriding the broker-wide prefetch.
This is the back-pressure window for the subscriber stream. When neither is set the server imposes no prefetch limit.
Sourcepub fn delay(self, delay: Delay) -> Self
pub fn delay(self, delay: Delay) -> Self
Makes retry_after / nack_after native, routing delayed redeliveries through a broker
waiting queue instead of the core in-process fallback.
Without this the runtime handles a delay with its broker-agnostic deferred re-publish
(at-most-once over the delay window, held in the service). With it, a delayed message is
re-published to the Delay waiting queue with a per-message TTL and dead-lettered back
to this queue when it fires, so the delayed copy lives on the broker.
The waiting queue is infrastructure: it is declared only when the broker opts into
declare_topology; otherwise provision it yourself.
Trait Implementations§
Source§impl Clone for RabbitQueue
impl Clone for RabbitQueue
Source§fn clone(&self) -> RabbitQueue
fn clone(&self) -> RabbitQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RabbitQueue
impl Debug for RabbitQueue
Source§impl PartialEq for RabbitQueue
impl PartialEq for RabbitQueue
impl StructuralPartialEq for RabbitQueue
Source§impl SubscriptionSource<LapinBroker> for RabbitQueue
impl SubscriptionSource<LapinBroker> for RabbitQueue
Source§type Subscriber = LapinSubscriber
type Subscriber = LapinSubscriber
Source§async fn subscribe(
self,
broker: &LapinBroker,
) -> Result<Self::Subscriber, AmqpError>
async fn subscribe( self, broker: &LapinBroker, ) -> Result<Self::Subscriber, AmqpError>
Source§impl SubscriptionSource<LapinTestBroker> for RabbitQueue
Available on crate feature testing only.
impl SubscriptionSource<LapinTestBroker> for RabbitQueue
testing only.