it is not the same.
Kafka's 'auto.offset.reset' is used when the configured consumer group
id does not have offset info stored in kafka. not exist. If you want
to consume from latest no matter whether there is group offset info in
kafka, you should use flink's setStartFromLatest.

suman shil <cncf.s...@gmail.com> 于2021年8月5日周四 上午6:35写道:
>
> In my flink streaming application I have kafka datasource. I am using the 
> kafka property auto.offset.reset=latest. I am wondering if I need to use 
> FlinkKafkaConsumer.setStartFromLatest(). Are they similar? Can I use either 
> of them? Following is the documentation from flink code.
> /**
>  * Specifies the consumer to start reading from the latest offset for all 
> partitions. This lets
>  * the consumer ignore any committed group offsets in Zookeeper / Kafka 
> brokers.
>  *
>  * <p>This method does not affect where partitions are read from when the 
> consumer is restored
>  * from a checkpoint or savepoint. When the consumer is restored from a 
> checkpoint or savepoint,
>  * only the offsets in the restored state will be used.
>  *
>  * @return The consumer object, to allow function chaining.
>  */
> public FlinkKafkaConsumerBase<T> setStartFromLatest() {
>     this.startupMode = StartupMode.LATEST;
>     this.startupOffsetsTimestamp = null;
>     this.specificStartupOffsets = null;
>     return this;
> }
>
> Thanks

Reply via email to