Which configuration and strategy combination is correct?
hard🚀 Application Q15 of Q15
Kafka - Message Delivery Semantics
You want to ensure your Kafka consumer starts reading from the earliest offset if no committed offset exists, but commits offsets manually only after processing batches of 10 messages. Which configuration and strategy combination is correct?
ASet <code>auto.offset.reset</code> to <code>earliest</code> and disable <code>enable.auto.commit</code>, then call <code>commitSync()</code> after every 10 messages
BSet <code>auto.offset.reset</code> to <code>latest</code> and enable <code>enable.auto.commit</code>, commit automatically every 10 messages
CSet <code>auto.offset.reset</code> to <code>earliest</code> and enable <code>enable.auto.commit</code>, commit manually after every message
DSet <code>auto.offset.reset</code> to <code>none</code> and disable <code>enable.auto.commit</code>, never commit offsets
Step-by-Step Solution
Solution:
Step 1: Choose offset reset policy
Setting auto.offset.reset to earliest ensures reading from the start if no offset exists.
Step 2: Select commit strategy
Disabling enable.auto.commit allows manual control; calling commitSync() after 10 messages commits offsets in batches.
Final Answer:
Set auto.offset.reset to earliest and disable enable.auto.commit, then call commitSync() after every 10 messages -> Option A
Quick Check:
earliest + manual commit after batch = correct strategy [OK]
Quick Trick:earliest + manual commit after batch = safe and controlled [OK]
Common Mistakes:
MISTAKES
Using latest offset reset when earliest is needed
Enabling auto commit but expecting manual control
Not committing offsets causing reprocessing
Master "Message Delivery Semantics" in Kafka
9 interactive learning modes - each teaches the same concept differently