kafka::producer

Struct Builder

source
pub struct Builder<P = DefaultPartitioner> { /* private fields */ }
Expand description

A Kafka Producer builder easing the process of setting up various configuration settings.

Implementations§

source§

impl Builder

source

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

Sets the compression algorithm to use when sending out data.

See KafkaClient::set_compression.

source

pub fn with_ack_timeout(self, timeout: Duration) -> Self

Sets the maximum time the kafka brokers can await the receipt of required acknowledgements (which is specified through Builder::with_required_acks.) Note that Kafka explicitly documents this not to be a hard limit.

source

pub fn with_connection_idle_timeout(self, timeout: Duration) -> Self

Specifies the timeout for idle connections. See KafkaClient::set_connection_idle_timeout.

source

pub fn with_required_acks(self, acks: RequiredAcks) -> Self

Sets how many acknowledgements the kafka brokers should receive before responding to sent messages.

See RequiredAcks.

source

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

Specifies a client_id to be sent along every request to Kafka brokers. See KafkaClient::set_client_id.

source§

impl<P> Builder<P>

source

pub fn with_partitioner<Q: Partitioner>(self, partitioner: Q) -> Builder<Q>

Sets the partitioner to dispatch when sending messages without an explicit partition assignment.

source

pub fn create(self) -> Result<Producer<P>>

Finally creates/builds a new producer based on the so far supplied settings.

Auto Trait Implementations§

§

impl<P> Freeze for Builder<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Builder<P>
where P: RefUnwindSafe,

§

impl<P> Send for Builder<P>
where P: Send,

§

impl<P> Sync for Builder<P>
where P: Sync,

§

impl<P> Unpin for Builder<P>
where P: Unpin,

§

impl<P> UnwindSafe for Builder<P>
where P: UnwindSafe,

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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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