Skip to the page

Streaming and CDC · Concept

Delivery guarantees and exactly-once claims

The interviewer asks

People say Kafka gives exactly-once. What do at-most-once, at-least-once and exactly-once really mean in a pipeline from Kafka to a warehouse, and where does exactly-once stop?

Then

Follow-ups the interviewer asks next

  1. Do you commit the consumer offset before or after writing? What does each give you?
  2. What do the idempotent producer and transactions do in Kafka?
  3. How does Spark Structured Streaming get exactly-once into a Delta table?
  4. The sink is Postgres or a REST API. Now what?
  5. What does "effectively once" mean?

The answer

What a strong answer covers

  • At-most-once: commit the offset, then process; a crash loses messages. At-least-once: process, then commit; a crash replays and duplicates. Exactly-once: the effect happens once, even with retries and crashes.
  • Inside Kafka: the idempotent producer (on by default since Kafka 3.0) removes duplicates from producer retries per partition; transactions make read-process-write between Kafka topics atomic, with the consumer offsets committed in the same transaction; readers use isolation.level=read_committed. Kafka Streams offers exactly_once_v2.
  • Exactly-once stops at Kafka's edge. An outside sink needs to be idempotent (upsert by key) or to store the offsets in the same transaction as the data.
  • Spark: a replayable source, offsets in the checkpoint and a transactional sink (each micro-batch is one Delta or Iceberg commit) give exactly-once into the table. foreachBatch into JDBC is at-least-once unless the write is a MERGE by key or tags the batch id (Delta supports idempotent writes with txnAppId and txnVersion).
  • Flink: checkpoints plus two-phase-commit sinks.
  • "Effectively once" is what most pipelines really do: at-least-once delivery plus idempotent writes or deduplication by event id. Event ids are needed anyway, because the app itself may send an event twice.
  • Kafka 4.2's share groups (queues) are production-ready but don't offer exactly-once.

The red pen

Common traps

Avoid:"turn on exactly-once in the config and you're done"; forgetting duplicates created by the producer app; thinking Kafka's guarantee covers writes into Postgres.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview