First time using Kafka and learned that there is no concept of auto deleting consumed messages from a topic which is fair so I am not asking why it is designed such way because I read and understood it.
What I want to know is that, avoid consuming same message again in Golang applications. How do you handle this please?
Using Kafka v3.3.2
and Sarama v1.43.2
.
consumer, _ := sarama.NewConsumer([]string{"localhost:9093"}, sarama.NewConfig())
partitions, _ := consumer.Partitions("logins")
for _, partition := range partitions {
pc, _ := consumer.ConsumePartition("logins", partition, sarama.OffsetOldest)
pc := pc
go func() {
for message := range pc.Messages() {
log.Println(string(message.Value))
}
}()
}