Quick revision
The short answer
I would decide per workload pattern, not once for everything: per-key ordered I/O work, unordered job-like work and CPU-bound batch work each fit a different option. We evaluate libraries above all on the correctness of offset tracking under rebalances and failures, standardise on a maintained library or Spring Kafka features rather than keep building, treat share groups as the future default for unordered jobs once they mature, and migrate the riskiest in-house frameworks first with a dated review.
What to remember
In this answer, we saw that the decision starts from three workload patterns rather than from the four options. We evaluate libraries first on offset-tracking correctness under rebalances and failures, then on project health, version support and observability. Share groups are a strong future default for unordered jobs, judged by their maturity in our versions rather than waited for. We stop building in-house, contribute upstream, migrate the riskiest frameworks first and review the decision on a fixed date.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would decide per workload pattern, not once for everything: per-key ordered I/O work, unordered job-like work and CPU-bound batch work each fit a different option. We evaluate libraries above all on the correctness of offset tracking under rebalances and failures, standardise on a maintained library or Spring Kafka features rather than keep building, treat share groups as the future default for unordered jobs once they mature, and migrate the riskiest in-house frameworks first with a dated review.
Why this question is asked
Five in-house frameworks with five sets of offset bugs is a common place for a large engineering organisation to end up. Each team solved a real problem, but offset tracking under rebalances is hard to get right, and every copy carries its own subtle data-loss risk. Interviewers ask this to see how a senior engineer turns a messy situation into a decision that lasts several years. In this answer, we will classify the workloads, define how we evaluate the options, look at share groups honestly, weigh building against buying, and lay out the plan and the decision record.
1Start From the Workloads, Not the Options
The four options are not competitors for the same job. So the first step is to list what the teams actually do. Most parallel processing falls into three patterns. Per-key ordered, I/O-bound work, such as updating an account per event with a 100 ms call, needs order per key and many calls in flight. Unordered job-like work, such as resizing images or sending emails, needs each record handled once, with retries, and no ordering at all. CPU-bound batch work, such as scoring a batch of transactions, needs batches and threads matched to cores.
When we map the five frameworks onto these patterns, we usually find that three of them solve the first pattern in slightly different ways, which is exactly where consolidation pays off.
| Pattern | Good default | Why |
|---|---|---|
| Per-key ordered, I/O-bound | Parallel consumer library | Key-ordered concurrency with offset tracking built in |
| Unordered jobs | Share groups when mature; until then a library or queue | Per-record acknowledgement, consumers beyond partitions |
| CPU-bound batches | Spring Kafka batch listener + concurrency | Simple, well supported, no extra library |
| Simple, low volume | Spring Kafka record listener | No parallelism needed |
2How We Evaluate a Library
The criterion that matters most is the one the in-house frameworks failed: correctness of offset tracking. A library is only acceptable if it never commits past an unfinished record, behaves correctly when partitions are revoked mid-flight, and documents what is redelivered after a crash. We verify that ourselves with a chaos test: a producer writes numbered records per key, consumers are killed and restarted at random, and a checker confirms that every record was processed at least once and per-key order held.
After correctness come project health (recent releases, active maintainers, how quickly issues are answered, the licence), support for the Kafka client and Spring versions we run, and observability: metrics for in-flight records, lag per key lane and retry counts. A library that is correct but invisible will still cause incidents.
3Share Groups: Promising, With a Date Attached
Share groups, introduced through KIP-932, let several consumers read the same partitions and acknowledge each record individually, with redelivery after a timeout. That is a natural fit for unordered job work and removes the need for any offset tracking in our code. They do not keep per-key order, so they do not help the first pattern.
They were early access in Kafka 4.0 and have been maturing since, so the honest position is to check their status in our broker and client versions, see whether Spring Kafka support exists in the version we run, and look for missing features such as dead-letter handling before betting on them. Waiting for them across the board would leave the current bugs in production for a year or more, so we do not wait; we plan to adopt them for one pattern when they are ready.
4Why We Stop Building
Building another framework feels cheap because the first version takes a few weeks. The cost is the years after: every Kafka client upgrade, every rebalance protocol change, every rare race found in production needs someone who understands that code. That correctness work rarely sets our business apart from competitors. So the default is a maintained option, and when we find a bug or a missing feature, we fix it upstream, which keeps us on the main line instead of a private fork.
- Classify the workload patternOrdered I/O, unordered jobs, CPU batches
- Does Spring Kafka cover it well?YesUse Spring Kafka featuresNoEvaluate libraries
- Library passes the chaos test?YesAdopt as the defaultNoTry the next option or contribute a fix
- Record the decisionWith a review date for share groups
4 steps in order. Play them, or step through them one at a time.
5The Plan for Three Years
We pick one default per pattern and write it down in a short decision record with the reasons and the test results. Then we rank the five in-house frameworks by risk: the one with known offset bugs on the most important data goes first. A platform engineer pairs with that team to migrate, which also improves the shared starter and documentation for the next team. Within a year the five should be at most two defaults, and new services get the defaults from a template.
Finally, we set a review date, for example every six months, to look again at share groups and their client support. When they are ready, the unordered pattern moves to them, and the library stays for ordered work.
6Follow-up questions
What if a team insists its framework is special?
We ask for the requirement that the defaults cannot meet and test it. Sometimes it is real, such as a strict latency target, and then the team keeps it but owns the chaos test and the upgrade work. Usually the requirement fits a default, and the data settles it without a long debate.
How do you measure success?
Fewer frameworks, zero open offset-tracking incidents, migrations completed per quarter, and the time a new service needs to get parallel processing working. We also track redelivery counts after rebalances, because a correct framework should show bounded, explained redelivery.
Does Spring Kafka itself offer parallelism within a partition?
Its main lever is container concurrency, which is limited by partitions, plus batch listeners and asynchronous acknowledgement in recent versions. That is enough for many workloads, but key-ordered concurrency within a partition generally needs a library, so check what the version you run provides.
7Conclusion
In this answer, we saw that the decision starts from three workload patterns rather than from the four options. We evaluate libraries first on offset-tracking correctness under rebalances and failures, then on project health, version support and observability. Share groups are a strong future default for unordered jobs, judged by their maturity in our versions rather than waited for. We stop building in-house, contribute upstream, migrate the riskiest frameworks first and review the decision on a fixed date.
Open with
I would not pick one answer for everything, because the teams have different workloads. I would classify them into per-key ordered I/O work, unordered job-like work and CPU-bound batch work, and pick a default for each.
Then, if they want more
The most important evaluation criterion is the one the in-house frameworks got wrong: offset tracking under rebalances and crashes. I would run a chaos test on any candidate, killing consumers at random and checking that every record was processed at least once and per-key order held, then look at project health, support for our Kafka and Spring versions, and metrics.
For ordered I/O work a maintained parallel consumer library is likely the default; for CPU batches Spring Kafka batch listeners are enough; for unordered jobs share groups are the natural future fit, but I would judge their maturity and client support in our versions rather than wait for them, so they get a review date.
I would stop building in-house, since that correctness work does not differentiate us, and contribute fixes upstream instead. Then I would migrate the riskiest framework first, with a platform engineer pairing with that team, write it all in a decision record, and revisit it every six months.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.0
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "The options are to adopt an open-source parallel consumer library, standardise on Spring...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-clients-in-depth/a6646fbe5b/