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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRebalanceListener.java:
##########
@@ -154,18 +171,45 @@ public interface ConsumerRebalanceListener {
      * necessary to catch these exceptions and re-attempt to wakeup or 
interrupt the consumer thread.
      *
      * @param partitions The list of partitions that were assigned to the 
consumer and now need to be revoked. This will
-     *                  include the full assignment under the Classic/Eager 
protocol, given that it revokes all partitions.
+     *                   include the full assignment under the Classic/Eager 
protocol, given that it revokes all partitions.
      *                   It will only include the subset to revoke under the 
Classic/Cooperative and Consumer protocols.
      * @throws org.apache.kafka.common.errors.WakeupException If raised from a 
nested call to {@link KafkaConsumer}
      * @throws org.apache.kafka.common.errors.InterruptException If raised 
from a nested call to {@link KafkaConsumer}
      */
-    void onPartitionsRevoked(Collection<TopicPartition> partitions);
+    default void onPartitionsRevoked(Collection<TopicPartition> partitions) {}

Review Comment:
   > Since we're naming the new interface RebalanceConsumer
   
   yes, `RebalanceConsumer` is a good name.
   
   > Defining a standalone super-interface that's not really implementable is 
already present in the codebase I see: like Measurable (or Serializable in 
java).
   
   I may give a rough example, but the point was the new interface should be 
highly implementable. For example:
   ```java
   // The new, clean interface moving forward
   public interface RebalanceConsumer {
       void onPartitionsAssigned(Collection<TopicPartition> partitions, 
RebalanceConsumer consumer) {}
   }
   
   // The legacy interface extends the new one 
   public interface ConsumerRebalanceListener extends RebalanceConsumer {
       // Kept abstract, so Scala users won't be forced to add 'override'
       void onPartitionsAssigned(Collection<TopicPartition> partitions);
   
       @Override
       void onPartitionsAssigned(Collection<TopicPartition> partitions, 
RebalanceConsumer consumer) {
           onPartitionsAssigned(partitions);
       }
   }
   ```



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