Struct rdkafka::producer::BaseProducer
[−]
[src]
pub struct BaseProducer<C: ProducerContext> { /* fields omitted */ }
Simple Kafka producer. This producer needs to be poll
ed at regular intervals in order to
serve queued delivery report callbacks. This producer can be cheaply cloned to
create a new reference to the same underlying producer. Data production should be done using the
BaseProducerTopic
, that can be created from this producer.
Methods
impl<C: ProducerContext> BaseProducer<C>
[src]
fn poll(&self, timeout_ms: i32) -> i32
Polls the producer. Regular calls to poll
are required to process the evens
and execute the message delivery callbacks.
fn send_copy<P, K>(
&self,
topic_name: &str,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>,
delivery_context: Option<Box<C::DeliveryContext>>,
timestamp: Option<i64>
) -> KafkaResult<()> where
K: ToBytes,
P: ToBytes,
&self,
topic_name: &str,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>,
delivery_context: Option<Box<C::DeliveryContext>>,
timestamp: Option<i64>
) -> KafkaResult<()> 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. If no key is specified, a random partition will be used.
Trait Implementations
impl<C: ProducerContext> Clone for BaseProducer<C>
[src]
fn clone(&self) -> BaseProducer<C>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl FromClientConfig for BaseProducer<EmptyProducerContext>
[src]
fn from_config(
config: &ClientConfig
) -> KafkaResult<BaseProducer<EmptyProducerContext>>
config: &ClientConfig
) -> KafkaResult<BaseProducer<EmptyProducerContext>>
Creates a new BaseProducer
starting from a configuration.
impl<C: ProducerContext> FromClientConfigAndContext<C> for BaseProducer<C>
[src]
fn from_config_and_context(
config: &ClientConfig,
context: C
) -> KafkaResult<BaseProducer<C>>
config: &ClientConfig,
context: C
) -> KafkaResult<BaseProducer<C>>
Creates a new BaseProducer
starting from a configuration and a context.