[−][src]Struct nsq_client::Config
Configuration sent to nsqd to properly config the Connection
Examples
use nsq_client::{Connection, Config}; fn main() { let sys = System::new("consumer"); let config = Config::new().client_id("consumer").user_agent("node-1"); Supervisor::start(|_| Connection::new( "test", "test", "0.0.0.0:4150", Some(config), None, None, )); sys.run(); }
Fields
client_id: Option<String>Identifiers sent to nsqd representing this client (consumer specific)
Default: hostname where connection is started
hostname: Option<String>Hostname where client is deployed.
Default: hostname where connection is started
feature_negotiation: boolEnable feature_negotiation
Default: true
heartbeat_interval: i64Duration of time between heartbeats (milliseconds).
Valid values:
- -1 disables heartbeats
- 1000 <= heartbeat_interval <= configured_max
Default: 30000
output_buffer_size: u64Size of the buffer (in bytes) used by nsqd for buffering writes to this connection
Valid values:
- -1 disable output buffer
- 64 <= output_buffer_size <= configured_max
Default: 16384
output_buffer_timeout: u32The timeout after which data nsqd has buffered will be flushed to this client.
Valid values:
- -1 disable buffer timeout
- 1ms <= output_buffer_timeout <= configured_max
Default: 250
tls_v1: boolEnable TLS negotiation
Default: false (Not implemented)
snappy: boolEnable snappy compression.
Default: false (Not implemented)
deflate: boolEnable deflate compression.
Default: false (Not implemented)
deflate_level: u16Configure deflate compression level.
Valid range:
- 1 <= deflate_level <= configured_max
Default: 6
sample_rate: u16Integer percentage to sample the channel.
Deliver a perventage of all messages received to this connection.
Default: 0
user_agent: StringString indentifying the agent for this connection.
Default: hostname where connection is started
message_timeout: u32Timeout used by nsqd before flushing buffered writes (set to 0 to disable).
Default: 0
Methods
impl Config[src]
pub fn new() -> Config[src]
Create default Config
use nsq_client::{Config}; fn main() { let config = Config::new(); assert_eq!(config, Config::default()); }
pub fn client_id<S: Into<String>>(self, client_id: S) -> Self[src]
Change client_id
use nsq_client::Config; fn main() { let config = Config::new().client_id("consumer"); assert_eq!(config.client_id, Some("consumer".to_owned())); }
pub fn hostname<S: Into<String>>(self, hostname: S) -> Self[src]
Change hostname
use nsq_client::Config; fn main() { let config = Config::new().hostname("node-1"); assert_eq!(config.hostname, Some("node-1".to_owned())); }
pub fn user_agent<S: Into<String>>(self, user_agent: S) -> Self[src]
Change user_agent
use nsq_client::Config; fn main() { let config = Config::new().user_agent("consumer-1"); assert_eq!(config.user_agent, Some("consumer-1".to_owned())); }
Trait Implementations
impl Default for Config[src]
impl Clone for Config[src]
fn clone(&self) -> Config[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq<Config> for Config[src]
impl Debug for Config[src]
impl Serialize for Config[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl<'de> Deserialize<'de> for Config[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Erased for T
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,