Struct rdkafka::producer::base_producer::BaseProducer
[−]
[src]
pub struct BaseProducer<C: ProducerContext> { /* fields omitted */ }
Low level Kafka producer.
The BaseProducer
needs to be poll
ed at regular intervals in order to
serve queued delivery report callbacks (for more information, refer to the module-level
documentation. This producer can be cheaply cloned to create a new reference to the same
underlying producer.
Methods
impl<C: ProducerContext> BaseProducer<C>
[src]
pub fn poll<T: Into<Option<Duration>>>(&self, timeout: T) -> i32
[src]
Polls the producer. Regular calls to poll
are required to process the events
and execute the message delivery callbacks.
pub fn send_copy<P: ?Sized, K: ?Sized>(
&self,
topic_name: &str,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>,
delivery_opaque: C::DeliveryOpaque,
timestamp: Option<i64>
) -> KafkaResult<()> where
K: ToBytes,
P: ToBytes,
[src]
&self,
topic_name: &str,
partition: Option<i32>,
payload: Option<&P>,
key: Option<&K>,
delivery_opaque: C::DeliveryOpaque,
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. Note that some errors will cause an error to be returned straight-away, such as partition not defined, while others will be returned in the delivery callback. To correctly handle errors, the delivery callback should be implemented.
pub fn flush<T: Into<Option<Duration>>>(&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 FromClientConfig for BaseProducer<DefaultProducerContext>
[src]
fn from_config(
config: &ClientConfig
) -> KafkaResult<BaseProducer<DefaultProducerContext>>
[src]
config: &ClientConfig
) -> KafkaResult<BaseProducer<DefaultProducerContext>>
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>>
[src]
config: &ClientConfig,
context: C
) -> KafkaResult<BaseProducer<C>>
Creates a new BaseProducer
starting from a configuration and a context.
impl<C: ProducerContext> Clone for BaseProducer<C>
[src]
fn clone(&self) -> BaseProducer<C>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more