UladzislauBlok commented on code in PR #22570:
URL: https://github.com/apache/kafka/pull/22570#discussion_r3460860689
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/RecordCollectorTest.java:
##########
@@ -137,8 +138,21 @@ public class RecordCollectorTest {
private final StringSerializer stringSerializer = new StringSerializer();
private final ByteArraySerializer byteArraySerializer = new
ByteArraySerializer();
- private final StreamPartitioner<String, Object> streamPartitioner =
- (topic, key, value, numPartitions) ->
Optional.of(Collections.singleton(Integer.parseInt(key) % numPartitions));
+ private final StreamPartitioner<String, Object> streamPartitioner = new
StreamPartitioner<String, Object>() {
+ @SuppressWarnings("removal")
+ @Override
+ public Optional<Set<Integer>> partitions(final String topic, final
String key, final Object value, final int numPartitions) {
+ throw new AssertionError("Deprecated 4-argument partitions method
was called instead of 5-argument method containing headers.");
+ }
+
+ @Override
+ public Optional<Set<Integer>> partitions(final String topic, final
String key, final Object value, final Headers headers, final int numPartitions)
{
+ if (headers != null && headers.lastHeader("key") != null) {
Review Comment:
It looked to me as sensible yesterday, but I agree with you now. Especially
because header-less version throws exception, which is also kinda assertion
that it's not called. I will drop it
--
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]