Skip to main content

ProducerConfig

Struct ProducerConfig 

Source
pub struct ProducerConfig {
Show 24 fields pub bootstrap_servers: Vec<String>, pub client_id: String, pub security_protocol: SecurityProtocol, pub tls: TlsConfig, pub sasl: SaslConfig, pub acks: i16, pub enable_idempotence: bool, pub partitioner: ProducerPartitioner, pub compression: ProducerCompression, pub batch_size: usize, pub buffer_memory: usize, pub max_block: Duration, pub max_request_size: usize, pub partitioner_ignore_keys: bool, pub linger: Duration, pub delivery_timeout: Duration, pub request_timeout: Duration, pub metadata_max_age: Duration, pub retry_backoff: Duration, pub max_retries: usize, pub max_in_flight_requests_per_connection: usize, pub transactional_id: Option<String>, pub transaction_timeout: Duration, pub tcp_connector: Arc<dyn TcpConnector>,
}
Expand description

Producer Config.

Fields§

§bootstrap_servers: Vec<String>

Bootstrap Servers.

§client_id: String

Client Id.

§security_protocol: SecurityProtocol

Security Protocol.

§tls: TlsConfig

Tls.

§sasl: SaslConfig

Sasl.

§acks: i16

Acks.

§enable_idempotence: bool

Enable Idempotence.

§partitioner: ProducerPartitioner

Partitioner.

§compression: ProducerCompression

Compression.

§batch_size: usize

Batch Size.

§buffer_memory: usize

Total memory available to buffered producer records.

§max_block: Duration

Maximum time producer calls may wait for metadata or buffer capacity.

§max_request_size: usize

Maximum serialized Produce request size.

§partitioner_ignore_keys: bool

Whether the default partitioner should ignore record keys.

§linger: Duration

Linger.

§delivery_timeout: Duration

Delivery Timeout.

§request_timeout: Duration

Request Timeout.

§metadata_max_age: Duration

Metadata Max Age.

§retry_backoff: Duration

Retry Backoff.

§max_retries: usize

Max Retries.

§max_in_flight_requests_per_connection: usize

Max In Flight Requests Per Connection.

§transactional_id: Option<String>

Transactional Id.

§transaction_timeout: Duration

Transaction Timeout.

§tcp_connector: Arc<dyn TcpConnector>

TCP connector.

Implementations§

Source§

impl ProducerConfig

Source

pub fn new(bootstrap_server: 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_acks(self, acks: i16) -> Self

Sets acks and returns the updated value.

Source

pub fn with_enable_idempotence(self, enable_idempotence: bool) -> Self

Sets enable idempotence and returns the updated value.

Source

pub fn with_partitioner(self, partitioner: ProducerPartitioner) -> Self

Sets partitioner and returns the updated value.

Source

pub fn with_compression(self, compression: ProducerCompression) -> Self

Sets compression and returns the updated value.

Source

pub fn with_batch_size(self, batch_size: usize) -> Self

Sets batch size and returns the updated value.

Source

pub fn with_buffer_memory(self, buffer_memory: usize) -> Self

Sets total memory available to buffered records and returns the updated value.

Source

pub fn with_max_block(self, max_block: Duration) -> Self

Sets the maximum time producer calls may wait for metadata or buffer capacity.

Source

pub fn with_max_request_size(self, max_request_size: usize) -> Self

Sets maximum serialized Produce request size and returns the updated value.

Source

pub fn with_partitioner_ignore_keys(self, ignore_keys: bool) -> Self

Sets whether the default partitioner ignores record keys.

Source

pub fn with_linger(self, linger: Duration) -> Self

Sets linger and returns the updated value.

Source

pub fn with_delivery_timeout(self, delivery_timeout: Duration) -> Self

Sets delivery timeout 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_max_in_flight_requests_per_connection( self, max_in_flight: usize, ) -> Self

Sets max in-flight requests per broker connection and returns the updated value.

Source

pub fn with_transactional_id(self, transactional_id: impl Into<String>) -> Self

Sets transactional id and returns the updated value.

Source

pub fn with_transaction_timeout(self, transaction_timeout: Duration) -> Self

Sets transaction timeout 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.

Source

pub fn is_transactional(&self) -> bool

Returns whether transactional.

Source

pub fn is_idempotent(&self) -> bool

Returns whether idempotent.

Trait Implementations§

Source§

impl Clone for ProducerConfig

Source§

fn clone(&self) -> ProducerConfig

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 ProducerConfig

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