Struct rdkafka::producer::base_producer::ThreadedProducer
source · [−]pub struct ThreadedProducer<C> where
C: ProducerContext + 'static, { /* private fields */ }
Expand description
A low-level Kafka 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 events, such as delivery notifications. The thread will be
automatically stopped when the producer is dropped.
Implementations
pub fn send<'a, K, P>(
&self,
record: BaseRecord<'a, K, P, C::DeliveryOpaque>
) -> Result<(), (KafkaError, BaseRecord<'a, K, P, C::DeliveryOpaque>)> where
K: ToBytes + ?Sized,
P: ToBytes + ?Sized,
pub fn send<'a, K, P>(
&self,
record: BaseRecord<'a, K, P, C::DeliveryOpaque>
) -> Result<(), (KafkaError, BaseRecord<'a, K, P, C::DeliveryOpaque>)> where
K: ToBytes + ?Sized,
P: ToBytes + ?Sized,
Sends a message to Kafka.
See the documentation for BaseProducer::send
for details.
Trait Implementations
fn from_config(
config: &ClientConfig
) -> KafkaResult<ThreadedProducer<DefaultProducerContext>>
fn from_config(
config: &ClientConfig
) -> KafkaResult<ThreadedProducer<DefaultProducerContext>>
Creates a client from a client configuration. The default client context will be used. Read more
impl<C> FromClientConfigAndContext<C> for ThreadedProducer<C> where
C: ProducerContext + 'static,
impl<C> FromClientConfigAndContext<C> for ThreadedProducer<C> where
C: ProducerContext + 'static,
fn from_config_and_context(
config: &ClientConfig,
context: C
) -> KafkaResult<ThreadedProducer<C>>
fn from_config_and_context(
config: &ClientConfig,
context: C
) -> KafkaResult<ThreadedProducer<C>>
Creates a client from a client configuration and a client context.
Flushes any pending messages. Read more
Returns the number of messages that are either waiting to be sent or are sent but are waiting to be acknowledged. Read more
Enable sending transactions with this producer. Read more
Begins a new transaction. Read more
fn send_offsets_to_transaction<T: Into<Timeout>>(
&self,
offsets: &TopicPartitionList,
cgm: &ConsumerGroupMetadata,
timeout: T
) -> KafkaResult<()>
fn send_offsets_to_transaction<T: Into<Timeout>>(
&self,
offsets: &TopicPartitionList,
cgm: &ConsumerGroupMetadata,
timeout: T
) -> KafkaResult<()>
Associates an offset commit operation with this transaction. Read more
Commits the current transaction. Read more
Aborts the current transaction. Read more
Returns a reference to the ProducerContext
used to create this
producer. Read more