【发布时间】:2021-08-05 10:35:02
【问题描述】:
在我的 flink 应用程序中,我有 kafka 数据源。我正在使用 kafka 属性auto.offset.reset=latest。我想知道是否需要使用FlinkKafkaConsumer.setStartFromLatest()。它们相似吗?我可以使用其中任何一个吗?以下是来自 flink 代码的文档。但是不清楚这个方法和kafka属性有什么关系。
/**
* 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;
}
【问题讨论】:
标签: apache-kafka apache-flink flink-streaming