Senior
What Kafka requisites can be written when sending, and what is only available for reading?
sobes.tech AI
Answer from AI
In Kafka, when sending a message (by the producer), the following attributes can be specified:
- Message key: used to determine the partition.
- Message value: the main content.
- Topic: where to send the message.
- Headers: additional metadata.
- Timestamp: the creation time of the message (can be set manually or use the system time).
Attributes available only for reading during consumption (by the consumer):
- Offset: a unique number of the message in the partition.
- Partition: the number of the partition from which the message was read.
- Timestamp: the time the message was written to the broker (if not set by the producer).
Thus, when sending, you specify the key, value, headers, topic, and timestamp. When reading, these same data are available, as well as offset and partition, which cannot be changed.