Consumer Offsets — Concept Check
Questions on Consumer Offsets. Consumer groups commit offsets to the __consumer_offsets internal topic; on restart or rebalance, the consumer resumes from the last committed offset.
Questions in this quiz
8 questions on Consumer Offsets — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A consumer group has no committed offset and the `auto.offset.reset` is set to `earliest`. What will happen when the consumer starts?
- AIt will read all available records from the beginning.
- BIt will throw an error due to missing offsets.
- CIt will not read any records until an offset is committed.
- DIt will skip to the latest records and read only new ones.
2.A consumer is configured with `enable.auto.commit=true`. What risk does this pose?
- AOffsets will not be committed, leading to data loss.
- BThe consumer will never restart from the last committed offset.
- CMessages will be processed multiple times, causing duplicates.
- DMessages may be lost if a crash occurs after commit but before processing.
3.A service using manual commit crashes after processing but before committing. What is the result?
- AThe message will be lost and never processed again.
- BThe consumer will skip the message on restart.
- CThe message will be redelivered, leading to duplicate processing.
- DThe consumer will throw an error on restart.
4.Which `spring.kafka.listener.ack-mode` ensures at-least-once processing?
- ABATCH
- BRECORD
- CAUTO
- DMANUAL_IMMEDIATE
5.A consumer group wants to reprocess the last 2 hours of events. Which command should they use?
- A`kafka-consumer-groups.sh --reset-offsets --to-latest`
- B`kafka-consumer-groups.sh --reset-offsets --to-datetime ...`
- C`kafka-consumer-groups.sh --describe --to-earliest`
- D`kafka-consumer-groups.sh --describe --to-datetime ...`
6.A consumer group has `auto.offset.reset=latest`. What happens if there's no committed offset?
- AIt reads only new records from now onwards.
- BIt reads all records from the beginning.
- CIt waits for a manual offset reset.
- DIt throws an error due to missing offsets.
7.Why might someone incorrectly believe that at-most-once delivery is safe?
- AThey think offsets are committed after processing.
- BThey believe Kafka guarantees no message loss.
- CThey assume messages are processed before commit.
- DThey assume manual commit is always used.
8.What is the primary benefit of using manual commit with idempotent processing?
- AIt ensures at-least-once delivery with reduced risk of duplicates.
- BIt simplifies the consumer code significantly.
- CIt prevents any message loss even on crashes.
- DIt guarantees exactly-once delivery without transactions.