Trait kafka::producer::Partitioner [] [src]

pub trait Partitioner {
    fn partition(&mut self, topics: Topics, msg: &mut ProduceMessage);
}

A partitioner is given a chance to choose/redefine a partition for a message to be sent to Kafka. See also Record#with_partition.

Implementations can be stateful.

Required Methods

fn partition(&mut self, topics: Topics, msg: &mut ProduceMessage)

Supposed to inspect the given message and if desired re-assign the message's target partition.

topics a description of the currently known topics and their currently available partitions.

msg the message whose partition assignment potentially to change.

Implementors