Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current stateDraft

...

We propose adding a new method to the StreamPartitioner interface. To maintain backward compatibility, this will be a default method that delegates to the existing partitions method.

org.apache.kafka.streams.processor.StreamPartitioner

...


Code Block
languagejava
titleStreamPartitioner
public interface StreamPartitioner<K, V> {

    /**
     * Determine the number(s) of the partition(s) to which a record with the given key and value should be sent,

...


     * for the given topic and current partition count.

...


     * 

...


     * @param topic the topic name this record is sent to

...


     * @param key the key of the record

...


     * @param value the value of the record

...


     * @param numPartitions the total number of partitions

...


     * @return an Optional of Set of integers between 0 and {@code numPartitions-1}

...


     */

...


    Optional<Set<Integer>> partitions(String topic, K key, V value, int numPartitions);

...



    /**

...


     * Determine the number(s) of the partition(s) to which a record with the given key, value, and headers should be sent,

...


     * for the given topic and current partition count.

...


     * 

...


     * @param topic the topic name this record is sent to

...


     * @param key the key of the record

...


     * @param value the value of the record

...


     * @param headers the headers of the record

...


     * @param numPartitions the total number of partitions

...


     * @return an Optional of Set of integers between 0 and {@code numPartitions-1}

...


     */

...


    default Optional<Set<Integer>> partitions(String topic, K key, V value, Headers headers, int numPartitions) {

...


        return partitions(topic, key, value, numPartitions);

...


    }

...


}

...


Proposed Changes

Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.

...