Reputation: 183
Is there a way to delete a single record from a kafka topic? I know there is the script kafka-delete-records.sh that deletes the records that are before the specified offset on a specified topic and partition, but I want to be able to delete a record on an offset I specify. Is there a way to do that?
This is not on Java but on the bare kafka instance.
Upvotes: 2
Views: 3315
Reputation: 2621
On a compacted Topic you can mark a record as a 'tombstone' by publishing a message for the key you want to indicate is deleted with a null value. See answers here: Kafka not deleting key with tombstone
If the topic is not compacted, the record must be removed through retention policies. You cannot target individual offsets to remove.
Upvotes: 2