Bird
0
0

If no partition key is provided when sending a message in Kafka, what happens?

easy📝 Conceptual Q2 of 15
Kafka - Topics and Partitions
If no partition key is provided when sending a message in Kafka, what happens?
AThe message is rejected
BKafka uses the message timestamp as the key
CThe message is sent to partition 0 always
DKafka assigns the message to a random partition
Step-by-Step Solution
Solution:
  1. Step 1: Check Kafka behavior without partition key

    If no key is provided, Kafka uses a round-robin or random approach to assign partitions.
  2. Step 2: Understand default partition assignment

    This ensures load is balanced across partitions when no key guides routing.
  3. Final Answer:

    Kafka assigns the message to a random partition -> Option D
  4. Quick Check:

    No key means random partition assignment [OK]
Quick Trick: No key means random partition choice [OK]
Common Mistakes:
  • Assuming message is rejected without key
  • Thinking message always goes to partition 0
  • Believing timestamp is used as key automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes