Bird
0
0

In Kafka, what is the main purpose of assigning a key to a message?

easy📝 Conceptual Q1 of 15
Kafka - Producers
In Kafka, what is the main purpose of assigning a key to a message?
ATo determine the partition where the message will be stored
BTo encrypt the message content
CTo specify the message timestamp
DTo set the message priority in the queue
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kafka message key role

    The key in Kafka is used to decide which partition the message goes to, ensuring messages with the same key go to the same partition.
  2. Step 2: Compare options with key purpose

    Encryption, timestamp, and priority are not controlled by the key; only partitioning is.
  3. Final Answer:

    To determine the partition where the message will be stored -> Option A
  4. Quick Check:

    Message key = Partition selector [OK]
Quick Trick: Message key controls partitioning, not content or priority [OK]
Common Mistakes:
  • Thinking key encrypts the message
  • Confusing key with timestamp
  • Assuming key sets message priority

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes