Bird
Raised Fist0

You have a Kafka consumer with auto commit disabled and you call commitAsync() without a callback. What is a potential problem with this approach?

medium📝 Debug Q6 of Q15
Kafka - Message Delivery Semantics
You have a Kafka consumer with auto commit disabled and you call commitAsync() without a callback. What is a potential problem with this approach?
AOffsets will be committed twice causing data loss.
BCommit failures may go unnoticed, causing possible message reprocessing.
CThe consumer will throw a compile-time error.
DcommitAsync() will block the consumer thread until commit completes.
Step-by-Step Solution
Solution:
  1. Step 1: Understand commitAsync() without callback

    Without a callback, commit failures are not reported to the application.
  2. Step 2: Consequence of ignoring commit failures

    If commit fails silently, offsets may not be saved, leading to duplicate processing on restart.
  3. Final Answer:

    Commit failures may go unnoticed, causing possible message reprocessing. -> Option B
  4. Quick Check:

    commitAsync without callback risks silent failures [OK]
Quick Trick: Always provide callback to commitAsync to catch errors [OK]
Common Mistakes:
MISTAKES
  • Expecting compile-time error
  • Thinking commitAsync blocks
  • Assuming double commit causes data loss

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes