Skip to content

KAFKA-20684 [9/N]: Deprecate ConsumerRebalanceListener for removal - #23115

Open
adikou wants to merge 12 commits into
apache:trunkfrom
adikou:akousik/KAFKA-20684-deprecate
Open

KAFKA-20684 [9/N]: Deprecate ConsumerRebalanceListener for removal#23115
adikou wants to merge 12 commits into
apache:trunkfrom
adikou:akousik/KAFKA-20684-deprecate

Conversation

@adikou

@adikou adikou commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Add a @Deprecated annotation on the now deprecated and uses removed (subscribe* methods on Consumer + ConsumerRebalanceListener) with forRemoval=true so future compilation would fail on the project, and log a loud warning on any clients using it.

adikou added 12 commits August 6, 2026 07:25
…oads

Drops the three subscribe(X, Optional<ConsumerRebalanceListener>) overloads and
the listener argument at all 52 call sites, all in clients/src/test.
Switches the two example listeners to RebalanceListener and registers them via
setRebalanceListener. Comments now point at the RebalanceConsumer parameter, which
makes the operations they describe actually reachable. No behaviour change.
Switches ConsumerPerfRebListener, VerifiableConsumer and TransactionalMessageCopier
to RebalanceListener and registers them via setRebalanceListener.
WorkerSinkTask's HandleRebalance becomes a RebalanceListener, registered via
setRebalanceListener. Tests capture the listener from setRebalanceListener rather
than from subscribe. Callback bodies keep using the enclosing consumer field.
StreamsRebalanceListener implements RebalanceListener and StreamThread registers it
via setRebalanceListener. RegexSourceIntegrationTest now intercepts by overriding
setRebalanceListener, since that is what StreamThread calls. StreamThreadTest's
subscribe verifications are split so they keep asserting something real.
…istener

Migrates rather than suppressing: -Xfatal-warnings applies to compileTestScala, and
a @nowarn that suppresses nothing is itself fatal.
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.
Migrates the shared TestConsumerReassignmentListener fixture and its call sites.
Tests that exist to cover the deprecated bridge or the deprecated subscribe
overloads are deliberately left on ConsumerRebalanceListener.
Marks the interface and the three subscribe(..., ConsumerRebalanceListener) overloads
@deprecated(since = "4.4", forRemoval = true), and adds @SuppressWarnings("removal")
to the declarations that must retain them. Must land after the migration commits:
-Werror covers every main source set and -Xfatal-warnings covers compileTestScala.
@adikou

adikou commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Waiting on 1-8/N merging in which case this PR would only be addition of the @Deprecated anno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant