Bird
0
0

In a Kafka consumer with manual commit, the developer calls commitAsync() but does not handle commit failures. What is a likely consequence?

medium📝 Debug Q7 of 15
Kafka - Consumers
In a Kafka consumer with manual commit, the developer calls commitAsync() but does not handle commit failures. What is a likely consequence?
AOffsets may not be committed, causing duplicate message processing
BConsumer will crash immediately on commit failure
CcommitAsync() will block until commit succeeds
DOffsets will be committed synchronously instead
Step-by-Step Solution
Solution:
  1. Step 1: Understand commitAsync() behavior

    commitAsync() commits offsets asynchronously and may fail without blocking or throwing exceptions.
  2. Step 2: Analyze missing failure handling

    Without handling failures, commit failures go unnoticed, causing offsets not to be saved and duplicates on restart.
  3. Final Answer:

    Offsets may not be committed, causing duplicate message processing -> Option A
  4. Quick Check:

    commitAsync() without error handling risks lost commits [OK]
Quick Trick: Always handle commitAsync() failures to avoid duplicates [OK]
Common Mistakes:
  • Expecting commitAsync() to block
  • Assuming consumer crashes on commit failure
  • Believing commitAsync() commits synchronously

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes