A string, number, binary, etc, value used in Messages.

If the Message Key is null, data is sent Round Robin across the Topic Partitions by the Producer. This enables Load Balancing.

If the Message Key is not null, then all Messages for that key will always go to the same Partition using Hashing.

The Message Key is a part of the Message

Pasted image 20230301203714.webp

References

Quote

A message can have an optional piece of metadata, which is referred to as a key. The key is also a byte array and, as with the message, has no specific meaning to Kafka. Keys are used when messages are to be written to partitions in a more controlled manner (Page 4) #✂️

Flashcards

True/False a Message Key can be null:: true

Message Key::: A string, number, binary value used in Messages that dictates what Partition a message is sent to

If the Message Key is null::: Messages with this type of key are sent Round Robin across the Topic Partitions by the Producer

If the Message Key is not null::: Messages with this type of key will always go to the same Partition using Hashing