Struct kafka::producer::Producer [] [src]

pub struct Producer<P = DefaultPartitioner> {
    // some fields omitted
}

The Kafka Producer

See module level documentation.

Methods

impl Producer
[src]

fn from_client(client: KafkaClient) -> Builder<DefaultPartitioner>

Starts building a new producer using the given Kafka client.

fn from_hosts(hosts: Vec<String>) -> Builder<DefaultPartitioner>

Starts building a producer bootstraping internally a new kafka client from the given kafka hosts.

fn client(self) -> KafkaClient

Destroys this producer returning the underlying kafka client.

impl<P: Partitioner> Producer<P>
[src]

fn send<'a, K, V>(&mut self, rec: &Record<'a, K, V>) -> Result<()> where K: AsBytes, V: AsBytes

Synchronously send the specified message to Kafka.

fn send_all<'a, K, V>(&mut self, recs: &[Record<'a, K, V>]) -> Result<Vec<TopicPartitionOffset>> where K: AsBytes, V: AsBytes

Synchronously send all of the specified messages to Kafka.