Skip to main content

ConsumerConfig

Struct ConsumerConfig 

Source
pub struct ConsumerConfig {
Show 24 fields pub bootstrap_servers: Vec<String>, pub client_id: String, pub group_id: String, pub security_protocol: SecurityProtocol, pub tls: TlsConfig, pub sasl: SaslConfig, pub request_timeout: Duration, pub metadata_max_age: Duration, pub retry_backoff: Duration, pub max_retries: usize, pub rebalance_timeout: Duration, pub fetch_max_wait: Duration, pub fetch_min_bytes: i32, pub fetch_max_bytes: i32, pub partition_max_bytes: i32, pub auto_offset_reset: AutoOffsetReset, pub isolation_level: IsolationLevel, pub enable_auto_commit: bool, pub auto_commit_interval: Duration, pub server_assignor: Option<String>, pub rack_id: Option<String>, pub instance_id: Option<String>, pub rebalance_listener: Option<ConsumerRebalanceListener>, pub tcp_connector: Arc<dyn TcpConnector>,
}
Expand description

Consumer Config.

Fields§

§bootstrap_servers: Vec<String>

Bootstrap Servers.

§client_id: String

Client Id.

§group_id: String

Group Id.

§security_protocol: SecurityProtocol

Security Protocol.

§tls: TlsConfig

Tls.

§sasl: SaslConfig

Sasl.

§request_timeout: Duration

Request Timeout.

§metadata_max_age: Duration

Metadata Max Age.

§retry_backoff: Duration

Retry Backoff.

§max_retries: usize

Max Retries.

§rebalance_timeout: Duration

Rebalance Timeout.

§fetch_max_wait: Duration

Fetch Max Wait.

§fetch_min_bytes: i32

Fetch Min Bytes.

§fetch_max_bytes: i32

Fetch Max Bytes.

§partition_max_bytes: i32

Partition Max Bytes.

§auto_offset_reset: AutoOffsetReset

Auto Offset Reset.

§isolation_level: IsolationLevel

Isolation Level.

§enable_auto_commit: bool

Enable Auto Commit.

§auto_commit_interval: Duration

Auto Commit Interval.

§server_assignor: Option<String>

Server Assignor.

§rack_id: Option<String>

Rack Id.

§instance_id: Option<String>

Instance Id.

§rebalance_listener: Option<ConsumerRebalanceListener>

Rebalance Listener.

§tcp_connector: Arc<dyn TcpConnector>

TCP connector.

Implementations§

Source§

impl ConsumerConfig

Source

pub fn new( bootstrap_server: impl Into<String>, group_id: impl Into<String>, ) -> Self

Creates a new value.

Source

pub fn with_client_id(self, client_id: impl Into<String>) -> Self

Sets client id and returns the updated value.

Source

pub fn with_bootstrap_servers( self, servers: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Sets bootstrap servers and returns the updated value.

Source

pub fn with_security_protocol(self, security_protocol: SecurityProtocol) -> Self

Sets security protocol and returns the updated value.

Source

pub fn with_tls(self, tls: TlsConfig) -> Self

Sets tls and returns the updated value.

Source

pub fn with_tls_ca_cert_path(self, path: impl Into<PathBuf>) -> Self

Sets tls ca cert path and returns the updated value.

Source

pub fn with_tls_client_auth_paths( self, cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>, ) -> Self

Sets tls client auth paths and returns the updated value.

Source

pub fn with_tls_server_name(self, server_name: impl Into<String>) -> Self

Sets tls server name and returns the updated value.

Source

pub fn with_sasl(self, sasl: SaslConfig) -> Self

Sets sasl and returns the updated value.

Source

pub fn with_sasl_plain( self, username: impl Into<String>, password: impl Into<String>, ) -> Self

Sets sasl plain and returns the updated value.

Source

pub fn with_sasl_scram_sha_256( self, username: impl Into<String>, password: impl Into<String>, ) -> Self

Sets sasl scram sha 256 and returns the updated value.

Source

pub fn with_sasl_scram_sha_512( self, username: impl Into<String>, password: impl Into<String>, ) -> Self

Sets sasl scram sha 512 and returns the updated value.

Source

pub fn with_request_timeout(self, request_timeout: Duration) -> Self

Sets request timeout and returns the updated value.

Source

pub fn with_metadata_max_age(self, metadata_max_age: Duration) -> Self

Sets metadata max age and returns the updated value.

Source

pub fn with_retry_backoff(self, retry_backoff: Duration) -> Self

Sets retry backoff and returns the updated value.

Source

pub fn with_max_retries(self, max_retries: usize) -> Self

Sets max retries and returns the updated value.

Source

pub fn with_rebalance_timeout(self, rebalance_timeout: Duration) -> Self

Sets rebalance timeout and returns the updated value.

Source

pub fn with_fetch_max_wait(self, fetch_max_wait: Duration) -> Self

Sets fetch max wait and returns the updated value.

Source

pub fn with_fetch_min_bytes(self, fetch_min_bytes: i32) -> Self

Sets fetch min bytes and returns the updated value.

Source

pub fn with_fetch_max_bytes(self, fetch_max_bytes: i32) -> Self

Sets fetch max bytes and returns the updated value.

Source

pub fn with_partition_max_bytes(self, partition_max_bytes: i32) -> Self

Sets partition max bytes and returns the updated value.

Source

pub fn with_auto_offset_reset(self, auto_offset_reset: AutoOffsetReset) -> Self

Sets auto offset reset and returns the updated value.

Source

pub fn with_isolation_level(self, isolation_level: IsolationLevel) -> Self

Sets isolation level and returns the updated value.

Source

pub fn with_enable_auto_commit(self, enable_auto_commit: bool) -> Self

Sets enable auto commit and returns the updated value.

Source

pub fn with_auto_commit_interval(self, auto_commit_interval: Duration) -> Self

Sets auto commit interval and returns the updated value.

Source

pub fn with_server_assignor(self, server_assignor: impl Into<String>) -> Self

Sets server assignor and returns the updated value.

Source

pub fn with_rack_id(self, rack_id: impl Into<String>) -> Self

Sets rack id and returns the updated value.

Source

pub fn with_instance_id(self, instance_id: impl Into<String>) -> Self

Sets instance id and returns the updated value.

Source

pub fn with_rebalance_listener( self, listener: ConsumerRebalanceListener, ) -> Self

Sets rebalance listener and returns the updated value.

Source

pub fn with_rebalance_callback( self, callback: impl Fn(ConsumerRebalanceEvent) + Send + Sync + 'static, ) -> Self

Sets rebalance callback and returns the updated value.

Source

pub fn with_tcp_connector(self, tcp_connector: Arc<dyn TcpConnector>) -> Self

Sets TCP connector and returns the updated value.

Trait Implementations§

Source§

impl Clone for ConsumerConfig

Source§

fn clone(&self) -> ConsumerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConsumerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more