pub struct ConsumerBuilder { /* private fields */ }Expand description
Consumer configuration builder
Implementations§
Source§impl ConsumerBuilder
impl ConsumerBuilder
pub fn new(connection: Arc<Connection>, queue_name: impl Into<String>) -> Self
Sourcepub fn bind_to_exchange(
self,
exchange: impl Into<String>,
routing_key: impl Into<String>,
) -> Self
pub fn bind_to_exchange( self, exchange: impl Into<String>, routing_key: impl Into<String>, ) -> Self
Bind to an exchange with routing key
Sourcepub fn routing_key(self, routing_key: impl Into<String>) -> Self
pub fn routing_key(self, routing_key: impl Into<String>) -> Self
Set routing key (for use with bind_to_exchange)
Sourcepub fn with_retry(self, retry_config: RetryConfig) -> Self
pub fn with_retry(self, retry_config: RetryConfig) -> Self
Configure retry behavior
Sourcepub fn with_dlq_ttl(self, ttl: Duration) -> Self
pub fn with_dlq_ttl(self, ttl: Duration) -> Self
Set TTL for dead letter queue (auto-cleanup failed messages) This is a convenience method that modifies the retry_config if it exists
§Example
ⓘ
let consumer = Consumer::builder(connection, "orders")
.with_retry(RetryConfig::exponential_default())
.with_dlq_ttl(Duration::from_secs(86400)) // 1 day
.build();Sourcepub fn with_prefetch(self, count: u16) -> Self
pub fn with_prefetch(self, count: u16) -> Self
Set prefetch count
Sourcepub fn manual_ack(self) -> Self
pub fn manual_ack(self) -> Self
Disable auto-acknowledge (manual ack required)
Auto Trait Implementations§
impl Freeze for ConsumerBuilder
impl !RefUnwindSafe for ConsumerBuilder
impl Send for ConsumerBuilder
impl Sync for ConsumerBuilder
impl Unpin for ConsumerBuilder
impl !UnwindSafe for ConsumerBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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