Bird
0
0

If a Kafka producer publishes data without specifying a key, where will the message be stored?

medium📝 Predict Output Q5 of 15
Kafka - Producers
If a Kafka producer publishes data without specifying a key, where will the message be stored?
AIn all partitions simultaneously
BAlways in the first partition
CIn a partition chosen in a round-robin fashion
DThe message will be rejected
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kafka's default partitioning behavior

    If no key is provided, Kafka distributes messages evenly using round-robin across partitions.
  2. Step 2: Confirm message storage location

    Messages go to partitions in turn, not always the first or all partitions.
  3. Final Answer:

    In a partition chosen in a round-robin fashion -> Option C
  4. Quick Check:

    No key means round-robin partitioning [OK]
Quick Trick: No key? Kafka uses round-robin to pick partition [OK]
Common Mistakes:
  • Assuming messages always go to first partition
  • Thinking messages duplicate in all partitions
  • Believing messages get rejected without key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes