Skip to content

Add batch consumer partition assignment strategy - #294

Open
Riya-bhardwaj wants to merge 3 commits into
gojek:masterfrom
Riya-bhardwaj:feature/batch-consumer-partition-assignment-strategy
Open

Add batch consumer partition assignment strategy#294
Riya-bhardwaj wants to merge 3 commits into
gojek:masterfrom
Riya-bhardwaj:feature/batch-consumer-partition-assignment-strategy

Conversation

@Riya-bhardwaj

Copy link
Copy Markdown

Problem
Batch consumers use Kafka's default RangeAssignor (eager rebalancing): every rebalance — deploy, restart, or scaling — makes all consumers revoke all partitions before reassigning ("stop-the-world"). There was no supported way to switch to cooperative rebalancing (CooperativeStickyAssignor).

Solution
New opt-in, per-route flag :partition-assignment-strategy. Omit it → unchanged default behavior (no impact on existing consumers). Generic by design — supports any assignor:

:partition-assignment-strategy :cooperative-sticky ; short name
:partition-assignment-strategy "org.apache.kafka.clients.consumer.CooperativeStickyAssignor" ; FQCN
:partition-assignment-strategy [:range :cooperative-sticky] ; ordered preference list (migration)
Short names: :range, :round-robin, :sticky, :cooperative-sticky. Unknown values fail loudly at startup.

⚠️ Migration (existing groups)
Eager → cooperative is protocol-incompatible; do a two-phase rolling deploy: phase 1 [:range :cooperative-sticky], then (after full rollout) phase 2 :cooperative-sticky. New groups can use :cooperative-sticky directly. Runbook in doc/kafka_produce_consume.md.

@Riya-bhardwaj
Riya-bhardwaj force-pushed the feature/batch-consumer-partition-assignment-strategy branch from ff20e01 to 16ace08 Compare July 21, 2026 04:47
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.

1 participant