CCDAK · Question #23
Producing with a key allows to...
The correct answer is B. Influence partitioning of the producer messages. Keys are necessary if you require strong ordering or grouping for messages that share the same key. If you require that messages with the same key are always seen in the correct order, attaching a key to messages will ensure messages with the same key always go to the same…
Question
Producing with a key allows to...
Options
- AEnsure per-record level security
- BInfluence partitioning of the producer messages
- CAdd more information to my message
- DAllow a Kafka Consumer to subscribe to a (topic,key) pair and only receive that data
How the community answered
(29 responses)- A7% (2)
- B90% (26)
- D3% (1)
Explanation
Keys are necessary if you require strong ordering or grouping for messages that share the same key. If you require that messages with the same key are always seen in the correct order, attaching a key to messages will ensure messages with the same key always go to the same partition in a topic. Kafka guarantees order within a partition, but not across partitions in a topic, so alternatively not providing a key - which will result in round-robin distribution across partitions - will not maintain such order.
Topics
Community Discussion
No community discussion yet for this question.