简体   繁体   中英

Removing one message from a topic in Kafka

I'm new at using Kafka and I have one question. Can I delete only ONE message from a topic if I know the topic, the offset and the partition? And if not is there any alternative?

It is not possible to remove a single message from a Kafka topic, even though you know its partition and offset.

Keep in mind, that Kafka is not a key/value store but a topic is rather an append-only(.) log that represents a stream of data.

If you are looking for alternatives to remove a single message you may

  1. Have your consumer clients ignore that message

  2. Enable log compaction and send a tompstone message

  3. Write a simple job (KafkaStreams) to consume the data, filter out that one message and produce all messages to a new topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM