We mentioned earlier that a message gets written to a topic. Yet since partitions make up a topic, messages in reality get written to and read from partitions. We can control which partition a message lands in with the use of message keys. A message key is treated like a byte array by Kafka and is optional. Say there are five partitions within a topic. One scheme might be to compute modulo five of the numeric value represented by the key and direct the message to the partition number equal to the result of the operation. Thus, all messages with the same key are written to the same partition.