pub struct QueueConfig {
pub name: String,
pub prefetch: u16,
pub retry: RetryPolicy,
pub durable: bool,
pub message_ttl: Option<Duration>,
pub max_priority: Option<u8>,
}Expand description
Static configuration of a single queue.
Fields§
§name: StringFully-qualified broker queue name (prefix already applied).
prefetch: u16Max unacknowledged messages per consumer.
retry: RetryPolicyDefault retry policy for jobs on this queue (a job may override).
durable: boolWhether the queue survives broker restarts.
message_ttl: Option<Duration>Optional per-message TTL applied on publish.
max_priority: Option<u8>Number of priority levels the main queue supports (x-max-priority on RabbitMQ).
None means the queue is not a priority queue and message priorities are
ignored by the broker. Deferred jobs (see crate::JobError::Deferred) are
republished with the highest level so they run ahead of the backlog.
Implementations§
Source§impl QueueConfig
impl QueueConfig
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Config for name with defaults: prefetch 16, durable, no retries, 10 priority levels.
Sourcepub fn prefetch(self, prefetch: u16) -> Self
pub fn prefetch(self, prefetch: u16) -> Self
Set the maximum number of unacknowledged messages per consumer.
Sourcepub fn retry(self, retry: RetryPolicy) -> Self
pub fn retry(self, retry: RetryPolicy) -> Self
Set the default retry policy for this queue.
Sourcepub fn message_ttl(self, ttl: Duration) -> Self
pub fn message_ttl(self, ttl: Duration) -> Self
Set a per-message TTL applied on publish.
Sourcepub fn max_priority(self, levels: u8) -> Self
pub fn max_priority(self, levels: u8) -> Self
Set the number of priority levels; 0 turns priorities off (max_priority = None).
Changing this for a queue that already exists on the broker is refused by
RabbitMQ (PRECONDITION_FAILED): delete the queue first.
Trait Implementations§
Source§impl Clone for QueueConfig
impl Clone for QueueConfig
Source§fn clone(&self) -> QueueConfig
fn clone(&self) -> QueueConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more