Junior — Middle
How long are messages stored in Kafka before deletion or archiving?
sobes.tech AI
Answer from AI
In Apache Kafka, messages are stored in topics on disk for a certain period, which is set by the retention.ms parameter. By default, this period is 7 days (604800000 milliseconds).
After this time, messages are automatically deleted or archived (depending on the settings).
It is also possible to configure storage by size (retention.bytes) or disable deletion by setting retention.ms to -1.
Thus, the message retention period in Kafka depends on the configuration, but by default, it is 7 days.