-
Hello all. So I have tried to used default parameters from Kafka, as shown below:
The goal is to remove each remaining topic message after a specified amount of time (in this case, I'm trying to keep messages only for 2 minutes). Correct me if I'm wrong, but I have understand that the retention period is used only to marks data segments for deletion. And if I want thoses data delete, I have to use the "cleaner". Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Kafka topics have two policies: delete and cleanup. With the cleanup policy, it is keeping the last message for given message key. With the delete policy, it will delete them based on time. But it will always only delete the whole log segments once all messages in them are over the retention time. You can have some control over how often that happens for example by configuring how often new segments are created (using The configuration you have above should work in general. But:
But the settings you have there would not do what you want. If you want to have some strict time-to-live / message-expiration style behaviour, I do not think Kafka is the right solution. |
Beta Was this translation helpful? Give feedback.
Kafka topics have two policies: delete and cleanup. With the cleanup policy, it is keeping the last message for given message key. With the delete policy, it will delete them based on time. But it will always only delete the whole log segments once all messages in them are over the retention time. You can have some control over how often that happens for example by configuring how often new segments are created (using
log.roll.ms
) so that the old segments are closed and can be deleted even when they are not full. But to do this so often might have performance impact.The configuration you have above should work in general. But: