You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "adikou (via GitHub)" <gi...@apache.org> on 2026/08/06 15:37:15 UTC

[PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

adikou opened a new pull request, #23109:
URL: https://github.com/apache/kafka/pull/23109

   Widens the private subscribeInternal helpers to RebalanceListener and retargets internal javadoc, including StickyAssignor's worked examples. Log strings now say RebalanceListener.onPartitionsX; no assertions depend on them.
   


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky merged PR #23109:
URL: https://github.com/apache/kafka/pull/23109


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23109:
URL: https://github.com/apache/kafka/pull/23109#issuecomment-5612145848

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4383563666


##########
clients/src/main/java/org/apache/kafka/clients/consumer/StickyAssignor.java:
##########
@@ -111,23 +111,23 @@
  * <li><code>C2 [t2p0, t2p1, t2p2]</code></li>
  * </ul>
  *</p>
- * <h3>Impact on <code>ConsumerRebalanceListener</code></h3>
+ * <h3>Impact on <code>RebalanceListener</code></h3>

Review Comment:
   It seems these changes are also included in #23115, but this patch is the smaller one, so I guess this PR should be merged first.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23109:
URL: https://github.com/apache/kafka/pull/23109#issuecomment-6093277374

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4360516579


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -2433,7 +2433,7 @@ boolean processBackgroundEvents(boolean skipAssignmentEvents) {
      * As an example, take {@link #unsubscribe()}. To start unsubscribing, the application thread enqueues an
      * {@link UnsubscribeEvent} on the application event queue. That event will eventually trigger the
      * rebalancing logic in the background thread. Critically, as part of this rebalancing work, the
-     * {@link ConsumerRebalanceListener#onPartitionsRevoked(Collection)} callback needs to be invoked for any
+     * {@link RebalanceListener#onPartitionsRevoked(Collection, RebalanceConsumer)} callback needs to be invoked for any

Review Comment:
   need to import org.apache.kafka.clients.consumer.RebalanceConsumer;
   



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java:
##########
@@ -441,9 +441,9 @@ private CompletableFuture<Void> enqueuePartitionsAssignedEvent(Set<TopicPartitio
     }
 
     /**
-     * Signals that a {@link ConsumerRebalanceListener} callback has completed. This is invoked when the
+     * Signals that a {@link RebalanceListener} callback has completed. This is invoked when the
      * application thread has completed the callback and has submitted a
-     * {@link ConsumerRebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we
+     * {@link RebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we

Review Comment:
   Do we have this event?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "adikou (via GitHub)" <gi...@apache.org>.
adikou commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4361026749


##########
clients/src/main/java/org/apache/kafka/clients/consumer/StickyAssignor.java:
##########
@@ -145,15 +145,15 @@
  * clarifies this point:
  * <pre>
  * {@code
- * class TheNewRebalanceListener implements ConsumerRebalanceListener {
+ * class TheNewRebalanceListener implements RebalanceListener {
  *   Collection<TopicPartition> lastAssignment = Collections.emptyList();
  *
- *   void onPartitionsRevoked(Collection<TopicPartition> partitions) {
+ *   void onPartitionsRevoked(Collection<TopicPartition> partitions, RebalanceConsumer consumer) {
  *     for (TopicPartition partition: partitions)
  *       commitOffsets(partition);

Review Comment:
   Done, both examples call consumer.commitSync()



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java:
##########
@@ -566,7 +566,7 @@ public void subscribe(SubscriptionPattern pattern) {
      * the max metadata age, the consumer will refresh metadata more often and check for matching topics.
      * <p>
      * See {@link #subscribe(Collection, ConsumerRebalanceListener)} for details on the
-     * use of the {@link ConsumerRebalanceListener}. Generally rebalances are triggered when there
+     * use of the {@link RebalanceListener}. Generally rebalances are triggered when there

Review Comment:
   done, points to `RebalanceListener`



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -2433,7 +2433,7 @@ boolean processBackgroundEvents(boolean skipAssignmentEvents) {
      * As an example, take {@link #unsubscribe()}. To start unsubscribing, the application thread enqueues an
      * {@link UnsubscribeEvent} on the application event queue. That event will eventually trigger the
      * rebalancing logic in the background thread. Critically, as part of this rebalancing work, the
-     * {@link ConsumerRebalanceListener#onPartitionsRevoked(Collection)} callback needs to be invoked for any
+     * {@link RebalanceListener#onPartitionsRevoked(Collection, RebalanceConsumer)} callback needs to be invoked for any

Review Comment:
   Added. I wonder if we should break the build if javadoc fails to build with broken link, nothing is breaking the CI right now.



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java:
##########
@@ -441,9 +441,9 @@ private CompletableFuture<Void> enqueuePartitionsAssignedEvent(Set<TopicPartitio
     }
 
     /**
-     * Signals that a {@link ConsumerRebalanceListener} callback has completed. This is invoked when the
+     * Signals that a {@link RebalanceListener} callback has completed. This is invoked when the
      * application thread has completed the callback and has submitted a
-     * {@link ConsumerRebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we
+     * {@link RebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we

Review Comment:
   Good catch, that class doesn't exist. The link points back at `ConsumerRebalanceListenerCallbackCompletedEvent`



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "adikou (via GitHub)" <gi...@apache.org>.
adikou commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4383710162


##########
clients/src/main/java/org/apache/kafka/clients/consumer/StickyAssignor.java:
##########
@@ -111,23 +111,23 @@
  * <li><code>C2 [t2p0, t2p1, t2p2]</code></li>
  * </ul>
  *</p>
- * <h3>Impact on <code>ConsumerRebalanceListener</code></h3>
+ * <h3>Impact on <code>RebalanceListener</code></h3>

Review Comment:
   #23115 is actually just me testing the "final" state. I keep rebasing it every time I merge 1-8/N so yeah, you'll see the changes there definitely. The final one actually has the `@Deprecated` anno which can only compile after I remove the actual usages. 



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4360619510


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerMembershipManager.java:
##########
@@ -441,9 +441,9 @@ private CompletableFuture<Void> enqueuePartitionsAssignedEvent(Set<TopicPartitio
     }
 
     /**
-     * Signals that a {@link ConsumerRebalanceListener} callback has completed. This is invoked when the
+     * Signals that a {@link RebalanceListener} callback has completed. This is invoked when the
      * application thread has completed the callback and has submitted a
-     * {@link ConsumerRebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we
+     * {@link RebalanceListenerCallbackCompletedEvent} to the network I/O thread. At this point, we

Review Comment:
   The event class is still named `ConsumerRebalanceListenerCallbackCompletedEvent`; this PR updates its listener references but does not rename the class. Linking to `RebalanceListenerCallbackCompletedEvent` therefore leaves an unresolved Javadoc reference. Keep the existing event-class name here while retargeting the listener-interface links. This is non-blocking.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4378727149


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -2433,7 +2433,7 @@ boolean processBackgroundEvents(boolean skipAssignmentEvents) {
      * As an example, take {@link #unsubscribe()}. To start unsubscribing, the application thread enqueues an
      * {@link UnsubscribeEvent} on the application event queue. That event will eventually trigger the
      * rebalancing logic in the background thread. Critically, as part of this rebalancing work, the
-     * {@link ConsumerRebalanceListener#onPartitionsRevoked(Collection)} callback needs to be invoked for any
+     * {@link RebalanceListener#onPartitionsRevoked(Collection, RebalanceConsumer)} callback needs to be invoked for any

Review Comment:
   I think we could file a jira for this.
   Could you please open a jira ticket?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "adikou (via GitHub)" <gi...@apache.org>.
adikou commented on PR #23109:
URL: https://github.com/apache/kafka/pull/23109#issuecomment-6419444727

   > Hi @adikou 
   > The PR LGTM, could you please fix the conflicts?
   
   Thanks, just rebased trunk


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23109:
URL: https://github.com/apache/kafka/pull/23109#issuecomment-6331878760

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-20684 [7/N]: Point clients internals at RebalanceListener [kafka]

Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on code in PR #23109:
URL: https://github.com/apache/kafka/pull/23109#discussion_r4360558262


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java:
##########
@@ -566,7 +566,7 @@ public void subscribe(SubscriptionPattern pattern) {
      * the max metadata age, the consumer will refresh metadata more often and check for matching topics.
      * <p>
      * See {@link #subscribe(Collection, ConsumerRebalanceListener)} for details on the
-     * use of the {@link ConsumerRebalanceListener}. Generally rebalances are triggered when there
+     * use of the {@link RebalanceListener}. Generally rebalances are triggered when there

Review Comment:
   nit: this sentence now points readers at `subscribe(Collection, ConsumerRebalanceListener)` (the legacy overload, soon to be deprecated) to learn about the new `RebalanceListener`. Since this is the javadoc of the internal helper, maybe simply:
   
   ```suggestion
        * use of rebalance callbacks. Generally rebalances are triggered when there
   ```
   
   and on the line above link to `{@link RebalanceListener}` (or `{@link #setRebalanceListener(RebalanceListener)}`) instead of the subscribe overload. The `@link`s at the top of this javadoc that mention `#subscribe(Pattern, ConsumerRebalanceListener)` are fine as-is, since that overload really is the caller of this helper.



##########
clients/src/main/java/org/apache/kafka/clients/consumer/StickyAssignor.java:
##########
@@ -145,15 +145,15 @@
  * clarifies this point:
  * <pre>
  * {@code
- * class TheNewRebalanceListener implements ConsumerRebalanceListener {
+ * class TheNewRebalanceListener implements RebalanceListener {
  *   Collection<TopicPartition> lastAssignment = Collections.emptyList();
  *
- *   void onPartitionsRevoked(Collection<TopicPartition> partitions) {
+ *   void onPartitionsRevoked(Collection<TopicPartition> partitions, RebalanceConsumer consumer) {
  *     for (TopicPartition partition: partitions)
  *       commitOffsets(partition);

Review Comment:
   nit: now that the example receives a `RebalanceConsumer consumer`, it could commit through it directly instead of the opaque `commitOffsets(partition)` helper, e.g. `consumer.commitSync(...)`. 
   That would show the point of the new API. Same applies to `TheOldRebalanceListener` above. 



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org