Bird
0
0

You want to build a Kafka Streams application that updates user balances exactly once, even if failures occur. Which approach ensures this behavior?

hard📝 Application Q15 of 15
Kafka - Advanced Stream Processing
You want to build a Kafka Streams application that updates user balances exactly once, even if failures occur. Which approach ensures this behavior?
AProcess messages without committing offsets to avoid duplicates.
BDisable transactions and rely on at-least-once processing with retries.
CUse idempotent producer with transactions and commit offsets atomically.
DUse multiple producers without transactions to increase throughput.
Step-by-Step Solution
Solution:
  1. Step 1: Understand exactly-once requirements

    Exactly-once needs atomic commit of data and offsets to avoid duplicates or loss.
  2. Step 2: Match approach to requirements

    Using idempotent producer with transactions and atomic offset commits ensures exactly-once updates.
  3. Final Answer:

    Use idempotent producer with transactions and commit offsets atomically. -> Option C
  4. Quick Check:

    Idempotent + transactions + atomic commit = exactly-once [OK]
Quick Trick: Atomic commit with idempotent producer ensures exactly-once [OK]
Common Mistakes:
  • Relying on retries without transactions causes duplicates
  • Using multiple producers without coordination breaks exactly-once
  • Not committing offsets leads to message reprocessing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes