I am using the confluent-kafka Python library to read from kafka. I am using the following consumer settings
Consumer ={
"bootstrap.servers" : kafka_server,
"group_id" : "testing",
"auto.offset.reset" : "latest"}
My goal is to ensure that I am always reading the latest messages in kafka. The above works as long as the program keeps running. But if the program crashes for some reason it starts reading from the message it last consumed instead of the last message in the topic.
I don't mind loosing a few messages but it is absolutely necessary that I am always reading the latest messages. Looks the Consumer remembers the offset and starts from it instead of from the latest one.
I tried setting the enable.auto.commit
parameter to False but I get the same results.