Struct rdkafka::producer::FutureProducer
[−]
[src]
#[must_use = "Producer polling thread will stop immediately if unused"] pub struct FutureProducer<C: ProducerContext + 'static> { /* fields omitted */ }
A producer with an internal running thread. This producer doesn't neeed to be polled.
The internal thread can be terminated with the stop
method or moving the
ProducerPollingThread
out of scope.
Methods
impl<C: ProducerContext> FutureProducer<C>
[src]
fn start(&mut self)
Starts the internal polling thread.
fn stop(&mut self)
Stops the internal polling thread. The thread can also be stopped by moving the ProducerPollingThread out of scope.
fn get_topic<'a>(&'a self,
name: &str,
config: &TopicConfig)
-> KafkaResult<Topic<'a, FutureProducerContext<C>>>
name: &str,
config: &TopicConfig)
-> KafkaResult<Topic<'a, FutureProducerContext<C>>>
Returns a topic associated to the current producer.
fn send_copy<P, K>(&self,
topic: &Topic<FutureProducerContext<C>>,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>)
-> KafkaResult<DeliveryFuture> where K: ToBytes, P: ToBytes
topic: &Topic<FutureProducerContext<C>>,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>)
-> KafkaResult<DeliveryFuture> where K: ToBytes, P: ToBytes
Sends a copy of the payload and key provided to the specified topic. When no partition is
specified the underlying Kafka library picks a partition based on the key.
Returns a DeliveryFuture
or an error.
Trait Implementations
impl FromClientConfig for FutureProducer<EmptyProducerContext>
[src]
fn from_config(config: &ClientConfig)
-> KafkaResult<FutureProducer<EmptyProducerContext>>
-> KafkaResult<FutureProducer<EmptyProducerContext>>
impl<C: ProducerContext> FromClientConfigAndContext<C> for FutureProducer<C>
[src]
fn from_config_and_context(config: &ClientConfig,
context: C)
-> KafkaResult<FutureProducer<C>>
context: C)
-> KafkaResult<FutureProducer<C>>