Bird
Raised Fist0

Given a Kafka consumer with enable.auto.commit=false and manual commit after processing, what happens if the consumer crashes before commit?

medium📝 Predict Output Q4 of Q15
Kafka - Message Delivery Semantics
Given a Kafka consumer with enable.auto.commit=false and manual commit after processing, what happens if the consumer crashes before commit?
AMessages will be reprocessed after restart, causing duplicates
BMessages are lost and never reprocessed
CConsumer automatically commits offsets before crash
DMessages are skipped and not delivered again
Step-by-Step Solution
Solution:
  1. Step 1: Understand manual commit behavior

    With auto commit disabled, offsets are only saved when committed manually.
  2. Step 2: Analyze crash before commit

    If crash happens before commit, offsets are not saved, so messages reprocessed on restart.
  3. Final Answer:

    Messages will be reprocessed after restart, causing duplicates -> Option A
  4. Quick Check:

    Manual commit + crash before commit = duplicates [OK]
Quick Trick: Manual commit requires commit before crash to avoid duplicates [OK]
Common Mistakes:
MISTAKES
  • Assuming auto commit happens even if disabled
  • Thinking messages are lost without commit
  • Believing messages are skipped after crash

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes