Bird
0
0

Given the following Kafka consumer configuration snippet, what will be the behavior if auto.offset.reset is set to earliest and the consumer group is new?

medium📝 Predict Output Q4 of 15
Kafka - Consumers

Given the following Kafka consumer configuration snippet, what will be the behavior if auto.offset.reset is set to earliest and the consumer group is new?

props.put("auto.offset.reset", "earliest");
AConsumer throws an error and stops
BConsumer starts reading from the earliest available offset
CConsumer starts reading from the latest offset
DConsumer ignores the setting and uses committed offsets
Step-by-Step Solution
Solution:
  1. Step 1: Understand auto.offset.reset behavior

    This setting controls where to start reading if no committed offset exists for the group.
  2. Step 2: Interpret the value earliest

    When set to earliest, the consumer reads from the beginning of the topic if the group is new.
  3. Final Answer:

    Consumer starts reading from the earliest available offset -> Option B
  4. Quick Check:

    auto.offset.reset=earliest means read from start if no offset [OK]
Quick Trick: earliest reads from start if no committed offset [OK]
Common Mistakes:
  • Assuming it reads from latest always
  • Expecting an error on new group
  • Ignoring committed offset logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes