You cannot delete messages in Kafka topic. You can:
- Set
log.retention.*
properties which is basically the expiration of messages. You can choose either time-based expiration (e. g. keep messages that are six hour old or newer) or space-based expiration (e. g. keep at max 1 GB of messages). See Broker config and search for retention. You can set different values for different topics.
- Delete the whole topic. It's a kind of tricky and I don't recommend this way.
- Create a new topic for every day. Something like my-topic-2015-09-21.
But I don't think you need to delete the messages in the topic at all. Because your Kafka consumer keeps track of messages that has been already processed. Thus when you read all today's messages, Kafka consumer saves this information and you're going to read just the new messages tomorrow.
Another possible solution could be Log compaction. But it's more complicated and probably it's not what you need. Basically you can set a key for every message in the Kafka topic. If you send two different messages with the same key, Kafka will keep just the newest message in the topic and it will delete all older messages with the same key. You can think of it as a kind of "key-value store". Every message with the same key just updates a value under the specific key. But hey, you really don't need this, it's just FYI :-).