Sobes.tech
Middle

What attributes does a message in Kafka have besides value?

sobes.tech AI

Answer from AI

In Kafka, a message consists not only of the value (payload), but also of several important attributes:

  • key — the message key, used for partitioning and ordering messages with the same key.
  • timestamp — the creation or record time of the message.
  • headers — a set of key-value pairs that allow adding metadata to the message.
  • partition — the number of the partition where the message is placed.
  • offset — a unique sequential number of the message within the partition.

For example, the key can be used to ensure that all messages with the same key go to the same partition, and headers can be used to pass additional information, such as message type or schema version.

What attributes does a message in Kafka have besides… - sobes.tech