Struct tokio_nsq::NSQConsumerConfig
source · pub struct NSQConsumerConfig { /* private fields */ }
Expand description
Configuration object for an NSQ consumer.
Implementations§
source§impl NSQConsumerConfig
impl NSQConsumerConfig
sourcepub fn new(topic: Arc<NSQTopic>, channel: Arc<NSQChannel>) -> Self
pub fn new(topic: Arc<NSQTopic>, channel: Arc<NSQChannel>) -> Self
A default configuration. You will likely need to configure other options.
sourcepub fn set_max_in_flight(self, max_in_flight: u32) -> Self
pub fn set_max_in_flight(self, max_in_flight: u32) -> Self
The maximum number of messages to process at once shared across all connections. Defaults to a single message.
sourcepub fn set_sources(self, sources: NSQConsumerConfigSources) -> Self
pub fn set_sources(self, sources: NSQConsumerConfigSources) -> Self
Where an NSQ consumer should find connections. Either an explicit list of NSQ Daemons, or a list of NSQ Lookup Daemons to find NSQ instances. Defaults to no connections.
NSQ Daemon connection options, such as compression and TLS.
sourcepub fn set_sample_rate(self, sample_rate: NSQSampleRate) -> Self
pub fn set_sample_rate(self, sample_rate: NSQSampleRate) -> Self
What percentage of messages to sample from the stream. Defaults to consuming all messages.
sourcepub fn set_rebalance_interval(self, rebalance_interval: Duration) -> Self
pub fn set_rebalance_interval(self, rebalance_interval: Duration) -> Self
To maintain max in flight NSQ Daemons need to periodically have the ready count rebalanced. For example as nodes fail. Defaults to every 5 seconds.
sourcepub fn set_max_requeue_interval(self, interval: Duration) -> Self
pub fn set_max_requeue_interval(self, interval: Duration) -> Self
The maximum limit on how long a requeued message is delayed. Defaults to 15 minutes.
sourcepub fn set_base_requeue_interval(self, interval: Duration) -> Self
pub fn set_base_requeue_interval(self, interval: Duration) -> Self
When a message is first requeued, this controls how long it should be delayed for. Defaults to 90 seconds.
sourcepub fn build(self) -> NSQConsumer
pub fn build(self) -> NSQConsumer
Construct an NSQ consumer with this configuration.
Trait Implementations§
source§impl Clone for NSQConsumerConfig
impl Clone for NSQConsumerConfig
source§fn clone(&self) -> NSQConsumerConfig
fn clone(&self) -> NSQConsumerConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more