Requirement - Consume only latest messages from the topic on Manual Restart or Unexpected Failure
When a Flink job fails and restarted, the job starts with restored checkpoint and this is trying to process the records from Kafka stored in the state. In order to avoid the old records, I tried changing the group id. Still the records from the checkpoint is being processed.
I am using the following code to process only the latest records. It works. But the only problem is that I am not able to ignore the state from checkpoint for Flink Kafak Consumer in case of unexpected failure.
Code: myConsumer.setStartFromLatest();
Documentation: https://ci.apache.org/projects/flink/flink-docs-stable/dev/connectors/kafka.html#kafka-consumers-start-position-configuration
My only requirement is to process the latest events from Kafka.
Thank you