aliehsaeedii commented on code in PR #22570:
URL: https://github.com/apache/kafka/pull/22570#discussion_r3460259509
##########
streams/src/main/java/org/apache/kafka/streams/processor/StreamPartitioner.java:
##########
@@ -53,17 +54,23 @@
@FunctionalInterface
public interface StreamPartitioner<K, V> {
+ @Deprecated(since = "4.3", forRemoval = true)
+ 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 and value should be sent,
+ * 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 headers the record headers
* @param numPartitions the total number of partitions
* @return an Optional of Set of integers between 0 and {@code
numPartitions-1},
* Empty optional means using default partitioner
* Optional of an empty set means the record won't be sent to any
partitions i.e drop it.
* Optional of Set of integers means the partitions to which the record
should be sent to.
* */
- Optional<Set<Integer>> partitions(String topic, K key, V value, int
numPartitions);
+ default Optional<Set<Integer>> partitions(final String topic, final K key,
final V value, final Headers headers, final int numPartitions) {
Review Comment:
Keeping the deprecated 4-arg method abstract while the new headers-aware
method is the default means new implementers must still implement the
deprecated method (as the tests do by throwing `AssertionError`). Was making
the new method abstract and the deprecated one a default considered? It would
break the `@FunctionalInterface`/existing-lambda compatibility, so this is
likely intentional — flagging only to confirm and state that it looks a bit
awkard. Is there cleaner way to address it? Even minor updated to the KIP is OK
I assume
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]