Skip to content

refactor: remove Alpakka Kafka deprecated APIs - #587

Draft
He-Pin wants to merge 3 commits into
apache:mainfrom
He-Pin:remove/alpakka-kafka-deprecated-apis
Draft

refactor: remove Alpakka Kafka deprecated APIs#587
He-Pin wants to merge 3 commits into
apache:mainfrom
He-Pin:remove/alpakka-kafka-deprecated-apis

Conversation

@He-Pin

@He-Pin He-Pin commented Jul 4, 2026

Copy link
Copy Markdown
Member

Motivation

  • ManualSubscription.rebalanceListener/withRebalanceListener were deprecated since Alpakka Kafka 1.0-RC1 (manual subscriptions never rebalance).
  • DrainingControl.shutdown() was deprecated since Alpakka Kafka 2.0.0 in favor of drainAndShutdown().

Modification

  • Remove deprecated rebalanceListener and withRebalanceListener from ManualSubscription trait. Concrete case classes (Assignment, AssignmentWithOffset, AssignmentOffsetsForTimes) already implement withRebalanceListener and now inherit rebalanceListener = None from the trait.
  • Simplify DrainingControl.shutdown() to delegate to control.shutdown() without the deprecated drain-and-wait behavior, making it consistent with other Control implementations.

Result

ManualSubscription no longer exposes misleading rebalance listener methods. DrainingControl.shutdown() delegates consistently with other Control methods.

Tests

Not run - deprecated API cleanup

References

None - deprecated API cleanup

Motivation:
ManualSubscription.rebalanceListener/withRebalanceListener were deprecated
since Alpakka Kafka 1.0-RC1. DrainingControl.shutdown() was deprecated since
Alpakka Kafka 2.0.0 in favor of drainAndShutdown().

Modification:
Remove deprecated rebalanceListener/withRebalanceListener from ManualSubscription
trait. Simplify DrainingControl.shutdown() to delegate to control.shutdown()
without the deprecated drain behavior.

Result:
ManualSubscription no longer exposes misleading rebalance listener methods.
DrainingControl.shutdown() delegates consistently with other Control methods.

Tests:
Not run - deprecated API cleanup

References:
None - deprecated API cleanup
@He-Pin
He-Pin marked this pull request as draft July 4, 2026 20:33
@He-Pin
He-Pin marked this pull request as ready for review July 5, 2026 04:25
@He-Pin
He-Pin requested a review from pjfanning July 5, 2026 18:53

/** @deprecated Manual subscriptions never rebalances, since Alpakka Kafka 1.0-RC1 */
@deprecated("Manual subscription never rebalances", "Alpakka Kafka 1.0-RC1")
def rebalanceListener: Option[ActorRef] = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep this function?


override def stop(): Future[Done] = control.stop()

@deprecated("Use `drainAndShutdown` for proper shutdown of the stream.", "Alpakka Kafka 2.0.0")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep this function deprecated?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean to revert it but since we are keeping the function, should we keep the retained function deprecated and continue to encourage users to use drainAndShutdown?

@He-Pin
He-Pin marked this pull request as draft July 5, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants