Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Leaders are asking whether the company should require exactly-once processing on all event pipelines. How would you answer and what policy would you propose?

I would advise against requiring Kafka's exactly-once mode everywhere, because it only covers Kafka-to-Kafka processing and adds latency, complexity and operating cost, while most pipelines are fine with at-least-once delivery, idempotent consumers and reconciliation. The policy I would propose sets required outcomes instead of mechanisms: money and legal records must be effectively-once, proven by reconciliation; teams choose the mechanism; critical pipelines are reviewed; and duplicates and losses are measured so the policy rests on data.

Why this question is asked

Questions like this come up after an incident: a customer was charged twice or a report counted orders twice, and someone proposes a rule so it never happens again. A blanket rule sounds responsible but can cost a lot and still miss the real cause. Interviewers ask it to see whether a senior engineer can turn a vague demand into a policy that protects the business without slowing every team. In this answer, we will explain what exactly-once does and costs, see why most needs are met another way, and then build the policy: outcome-based requirements, team choice of mechanism, reviews and measurement.

1What Exactly-Once Covers and What It Costs

Kafka's exactly-once semantics make a read-process-write cycle inside Kafka atomic: a transactional producer writes outputs and commits the consumed offsets in one transaction, and read_committed consumers ignore aborted data. It is valuable for stream processing that reads from Kafka and writes to Kafka. It does not reach outside Kafka: a database write, an email or a call to a payment API can still happen twice, and only the application can prevent that.

It also has costs. Consumers reading with read_committed must wait for transactions to commit, so end-to-end latency grows with the commit interval, often from tens of milliseconds to a few hundred. Producers and coordinators do more work, throughput can drop, and operations get harder: hanging transactions, fencing errors after rebalances and transactional.id management all need understanding. Requiring it for a pipeline that writes to a search index, where a duplicate write is harmless, buys nothing for that cost.

Mechanism vs outcome
PipelineDuplicate impactSensible approach
Payments to ledgerWrong balances, moneyEffectively-once: event ids, idempotent sink, daily reconciliation
Stream aggregation Kafka->KafkaWrong totals downstreamKafka EOS (exactly_once_v2) is a good fit
Search indexingNone: same document written againAt-least-once, idempotent upsert
Click analyticsSmall skew in countsAt-least-once, accept or dedupe in the warehouse
Customer emailsAnnoyed customerAt-least-once with a sent-message id check
The right protection depends on what a duplicate costs.

2Why At-Least-Once Plus Idempotency Usually Wins

For most consumers, the simplest reliable design is at-least-once delivery, where nothing is lost and some records are processed twice, combined with an idempotent consumer that makes the second processing harmless. An upsert keyed by entity id, a unique constraint on an event id, or a processed-ids table in the same database transaction all achieve that. These techniques work across every system boundary, which Kafka's transactions cannot.

Reconciliation then catches what idempotency misses, such as a source that re-sends an event with a new id. A job that compares counts and totals between systems is cheap and gives evidence, which is what auditors and finance teams actually ask for. So the combination of at-least-once, idempotency and reconciliation meets most business needs, including money, while Kafka EOS is one useful tool for the Kafka-internal part.

3The Policy: Outcomes, Not Mechanisms

I would propose a short policy with three tiers. For money and legal records, such as payments, invoices, ledgers and consent records, outcomes must be effectively-once: no duplicate and no lost business effect, verified by automated reconciliation at an agreed frequency with alerts on any difference. For important business data, such as orders and inventory, duplicates must be harmless through idempotent processing, and losses must be detectable. For everything else, at-least-once delivery is the default and teams document their tolerance.

The policy does not say 'use Kafka transactions'. Teams choose the mechanism that achieves the required outcome: Kafka EOS for stream processing, idempotent sinks, outbox patterns, or a mix. Mandating a mechanism would push teams to tick a box instead of thinking about where their duplicates come from, and the payment incident that started this discussion would not have been prevented by Kafka EOS anyway, because the duplicate happened at the payment API.

Step throughDeciding the protection for a pipeline
  1. Does it carry money or legal records?
    YesTier 1: effectively-once + reconciliationNoNext question
  2. Would a duplicate or loss harm customers or reports?
    YesTier 2: idempotent processing, detectable lossNoTier 3: at-least-once, documented tolerance
  3. Team chooses the mechanismEOS, idempotent sink, outbox, ...
  4. Tier 1 pipelines get a design reviewbefore launch and after major changes
  5. Measure duplicates and lossesdashboards feed the yearly policy review

5 steps in order. Play them, or step through them one at a time.

4Reviews and Shared Building Blocks

Leaving the choice to teams works only if critical pipelines are checked. Every tier 1 pipeline gets a short design review before launch and after major changes, walking through each hop: where an id is created, how each consumer deduplicates, and how reconciliation proves the result. The review is a conversation with experienced engineers, not a form.

The platform team makes the right thing easy: a library for processed-id tables, an outbox relay, a reconciliation job template, and guidance on when Kafka EOS is the right tool and how to operate it. Most teams will then follow the paved road because it is less work.

5Measure So the Policy Rests on Data

Finally, we measure. Reconciliation jobs already produce the key numbers: duplicates found, losses found and how long they took to repair, per pipeline and month. Consumers can count deduplicated deliveries, which shows how often the protection actually fired. Those numbers tell leaders whether the policy works and where to invest, for example that one pipeline found 120 duplicates last quarter while the others found none.

With data, the conversation changes from 'should everything be exactly-once?' to 'these two pipelines need better protection, and the rest are fine'. That is a decision leaders can make with confidence.

6Follow-up questions

What if leadership insists on a single simple rule?

Offer one simple rule about outcomes: 'Pipelines that carry money or legal records must prove, through reconciliation, that nothing is duplicated or lost.' It is as easy to state as 'use exactly-once everywhere', it actually covers the systems outside Kafka, and it can be audited.

When would you recommend Kafka EOS?

For stream processing that reads from Kafka and writes to Kafka, especially aggregations, joins and counters, where a duplicate input would change a result that cannot be easily deduplicated later. Kafka Streams with exactly_once_v2 makes it straightforward, and the extra latency is usually acceptable there.

How do you handle teams that never reconcile?

Make reconciliation part of the tier 1 checklist and give them the template job. For tiers 2 and 3, the review asks how a loss would be noticed; if the answer is 'a customer complains', that is a finding to fix.

7Conclusion

In this answer, we saw that Kafka's exactly-once covers only Kafka-to-Kafka processing and brings latency, complexity and operating cost, so requiring it everywhere would cost much and still miss duplicates at external systems. Most needs are met with at-least-once delivery, idempotent consumers and reconciliation. The proposed policy sets outcomes by tier, effectively-once with reconciliation for money and legal records, lets teams choose mechanisms, reviews critical pipelines and measures duplicates and losses so the policy is guided by data.

What to say in the interviewAbout 80 seconds aloud

Open with

I'd say no to a blanket requirement on the mechanism, and yes to a requirement on outcomes. Kafka's exactly-once covers read-process-write inside Kafka; it doesn't cover the database write or the payment API call at the end, which is usually where real duplicates happen.

Then, if they want more

It also adds latency because read_committed consumers wait for commits, and it adds operational complexity with transactions, fencing and hanging transactions. For most pipelines, at-least-once delivery with idempotent consumers and reconciliation is simpler and works across every boundary. So my proposal is tiered. For money and legal records, outcomes must be effectively-once, proven by automated reconciliation with alerts.

For important business data, processing must be idempotent and losses detectable. For everything else, at-least-once is fine and teams document their tolerance. Teams choose the mechanism, whether that's Kafka EOS for stream processing, an idempotent sink, or an outbox, and the platform provides libraries and templates so the right approach is the easy one.

Tier-one pipelines get a design review before launch. And we measure duplicates and losses from reconciliation, so after a few quarters we know which pipelines need more investment, and the policy is based on data rather than a slogan.

About this answer

Last updated
12 November 2026
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.
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 "Leaders are asking whether the company should require exactly-once processing on all...": https://scrivio-interview-library.netlify.app/spring-boot/kafka/5a5f0deb47/