AndrewJSchofield commented on code in PR #22270:
URL: https://github.com/apache/kafka/pull/22270#discussion_r3244431095


##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRebalanceListener.java:
##########
@@ -89,31 +103,37 @@
  * Here is pseudo-code for a callback implementation for saving offsets:
  * <pre>
  * {@code
- *   public class SaveOffsetsOnRebalance implements ConsumerRebalanceListener {
- *       private Consumer<?,?> consumer;
+ *   consumer.subscribe(List.of("topic-1", "topic-2"));
+ *   consumer.setConsumerRebalanceListener(new ConsumerRebalanceListener() {
+ *       @Override
+ *       public void onPartitionsRevoked(Collection<TopicPartition> 
partitions) {}

Review Comment:
   I think the best path forward is to amend KIP-1306. It seems to me that 
adding empty default implementations of the existing methods would fix the 
problem. Maybe I'm missing something.
   
   ```
   public interface ConsumerRebalanceListener {
     default void onPartitionsRevoked(Collection<TopicPartition> partitions) {}
     default void onPartitionsAssigned(Collection<TopicPartition> partitions) {}
     default void onPartitionsLost(Collection<TopicPartition> partitions) {
           onPartitionsRevoked(partitions);
       }
       default void onPartitionsAssigned(Collection<TopicPartition> partitions,
                                          RebalanceConsumer consumer) {
           onPartitionsAssigned(partitions);
       }
       default void onPartitionsRevoked(Collection<TopicPartition> partitions,
                                         RebalanceConsumer consumer) {
           onPartitionsRevoked(partitions);
       }
       default void onPartitionsLost(Collection<TopicPartition> partitions,
                                      RebalanceConsumer consumer) {
           onPartitionsRevoked(partitions, consumer);
       }
   }
   ```
   
   Does that do the job?



-- 
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]

Reply via email to