Hi,

I have been going through http://kafka.apache.org/documentation.html and
read below for providing custom partitioner.


   - provides software load balancing through an optionally user-specified
   Partitioner -

   The routing decision is influenced by the kafka.producer.Partitioner.

   interface Partitioner<T> {
      int partition(T key, int numPartitions);
   }

   The partition API uses the key and the number of available broker
   partitions to return a partition id. This id is used as an index into a
   sorted list of broker_ids and partitions to pick a broker partition for the
   producer request. The default partitioning strategy is
   hash(key)%numPartitions. If the key is null, then a random broker
   partition is picked. A custom partitioning strategy can also be plugged in
   using thepartitioner.class config parameter.


While in .8.2.0 kafka-clients jar, there is no interface Partitioner
though Partitioner
class is there which do partition based on below logic

i)If a partition is specified in the record, use it
ii)If no partition is specified but a key is present choose a partition
based on a hash of the key
iii)If no partition or key is present choose a partition in a round-robin
fashion



Am I missing something??

Reply via email to