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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRebalanceListener.java:
##########
@@ -48,27 +62,27 @@
  * whenever partition assignment changes.
  * <p>
  * Under normal conditions, if a partition is reassigned from one consumer to 
another, then the old consumer will
- * always invoke {@link #onPartitionsRevoked(Collection) onPartitionsRevoked} 
for that partition prior to the new consumer
- * invoking {@link #onPartitionsAssigned(Collection) onPartitionsAssigned} for 
the same partition. So if offsets or other state is saved in the
- * {@link #onPartitionsRevoked(Collection) onPartitionsRevoked} call by one 
consumer member, it will always be accessible by the time the
- * other consumer member taking over that partition and triggering its {@link 
#onPartitionsAssigned(Collection) onPartitionsAssigned} callback to load the 
state.
+ * always invoke {@link #onPartitionsRevoked(Collection, RebalanceConsumer) 
onPartitionsRevoked} for that partition prior to the new consumer
+ * invoking {@link #onPartitionsAssigned(Collection, RebalanceConsumer) 
onPartitionsAssigned} for the same partition. So if offsets or other state is 
saved in the
+ * {@link #onPartitionsRevoked(Collection, RebalanceConsumer) 
onPartitionsRevoked} call by one consumer member, it will always be accessible 
by the time the
+ * other consumer member taking over that partition and triggering its {@link 
#onPartitionsAssigned(Collection, RebalanceConsumer) onPartitionsAssigned} 
callback to load the state.

Review Comment:
   nit: This is not grammatical (and the original text which this PR is 
updating was not either).



##########
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:
   Having implementations for both the single-argument and two-argument 
variants of the callback methods doesn't seem ideal. We should show just the 
new preferred way really.



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