View Source Klife.Behaviours.Partitioner behaviour (Klife v0.5.0)
Behaviour to define a partitioner
Modules must implement this behaviour in order to be used as partitioners on
the Klife.Client
producer API.
Summary
Callbacks
Define the partition of a given record.
Callbacks
@callback get_partition( record :: %Klife.Record{ __batch_index: term(), __estimated_size: term(), error_code: term(), headers: term(), key: term(), offset: term(), partition: term(), topic: term(), value: term() }, max_partition :: integer() ) :: integer()
Define the partition of a given record.
Receives the record and the highest known partition for the record's topic.
Must return an integer between 0 and max_partition
. See Klife.Producer.DefaultPartitioner
for
an example.