[][src]Struct rdkafka::producer::base_producer::ThreadedProducer

#[must_use = "The threaded producer will stop immediately if unused"]
pub struct ThreadedProducer<C: ProducerContext + 'static> { /* fields omitted */ }

A producer with a separate thread for event handling.

The ThreadedProducer is a BaseProducer with a separate thread dedicated to calling poll at regular intervals in order to execute any queued event, such as delivery notifications. The thread will be automatically stopped when the producer is dropped.


impl<C: ProducerContext + 'static> ThreadedProducer<C>[src]

pub fn send<'a, K: ?Sized, P: ?Sized>(
    record: BaseRecord<'a, K, P, C::DeliveryOpaque>
) -> Result<(), (KafkaError, BaseRecord<'a, K, P, C::DeliveryOpaque>)> where
    K: ToBytes,
    P: ToBytes

Sends a message to Kafka. See the documentation in BaseProducer.

pub fn poll<T: Into<Timeout>>(&self, timeout: T)[src]

Polls the internal producer. This is not normally required since the ThreadedProducer had a thread dedicated to calling poll regularly.

pub fn flush<T: Into<Timeout>>(&self, timeout: T)[src]

Flushes the producer. Should be called before termination.

pub fn in_flight_count(&self) -> i32[src]

Returns the number of messages waiting to be sent, or send but not acknowledged yet.

Trait Implementations

impl<C: ProducerContext + 'static> Drop for ThreadedProducer<C>[src]

impl FromClientConfig for ThreadedProducer<DefaultProducerContext>[src]

impl<C: ProducerContext + 'static> FromClientConfigAndContext<C> for ThreadedProducer<C>[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for ThreadedProducer<C> where
    C: RefUnwindSafe

impl<C> Send for ThreadedProducer<C>

impl<C> Sync for ThreadedProducer<C>

impl<C> Unpin for ThreadedProducer<C>

impl<C> UnwindSafe for ThreadedProducer<C> where
    C: RefUnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.