Struct kafka::producer::DefaultPartitioner [] [src]

pub struct DefaultPartitioner {
    // some fields omitted
}

As its name implies DefaultPartitioner is the default partitioner for Producer.

Every received message with a non-negative value will not be changed by this partitioner and will be passed through as is.

For every message with an "unspecified" partition - this is a negative partition - it will try to find one. In a very simple manner, it tries to distribute such messsages across available partitions in a round robin fashion.

This behavior may not suffice every workload. If you're application is dependent on a particular distribution scheme, you want to provide your own partioner to the Producer at initialization time.

See Builder::with_partitioner.

Trait Implementations

impl Partitioner for DefaultPartitioner
[src]

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

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

impl Default for DefaultPartitioner
[src]

fn default() -> Self

Returns the "default value" for a type. Read more