Delete Arbitrary Messages from a Kafka

I’ve been asked a few times about how you can delete messages from a topic in Kafka. So for example, if you work for a company and you have a central Kafka instance, you might want to ensure that you can delete any arbitrary message due to say regulatory or data protection requirements or maybe simple in case something gets corrupted.

A potential trick to do this is to use a combination of (a) a compacted topic and (b) a custom partitioner (c) a pair of interceptors.

The process would follow:

Two caveats: (1) Log compaction does not touch the most recent segment, so values will only be deleted once the first segment rolls. This essentially means it may take some time for the ‘delete’ to actually occur. (2) I haven’t tested this!

 

Posted on October 6th, 2017 in Blog, Kafka/Confluent


  1. Joann June 7th, 2024
    7:03 GMT

    I don’t even know how I ended up here, but I thought
    this post was good. I don’t know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




Safari hates me
IMPORTANT! To be able to proceed, you need to solve the following simple problem (so we know that you are a human) :-)

Add the numbers ( 8 + 7 ) and SUBTRACT two ?
Please leave these two fields as-is:

Talks (View on YouTube)