Skip to content

Add batch consumer partition assignment strategy - #294

Merged
Vruttant1403 merged 4 commits into
gojek:masterfrom
Riya-bhardwaj:feature/batch-consumer-partition-assignment-strategy
Oct 12, 2026
Merged

Vruttant1403 merged 4 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
@Riya-bhardwaj
Riya-bhardwaj force-pushed the feature/batch-consumer-partition-assignment-strategy branch from cb96be4 to a2c0ec2 Compare October 7, 2026 11:26
@Vruttant1403
Vruttant1403 self-requested a review October 8, 2026 13:29
@Vruttant1403
Vruttant1403 merged commit 2763795 into gojek:master Oct 12, 2026
6 checks passed
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