原始碼解讀 flink 生成watermark的預設時間間隔
阿新 • • 發佈:2021-01-15
技術標籤:Flink
預設間隔是200ms
(1) 在 StreamExecutionEnvironmennt
的方法有體現
@PublicEvolving
public void setStreamTimeCharacteristic(TimeCharacteristic characteristic) {
this.timeCharacteristic = Preconditions.checkNotNull(characteristic);
if (characteristic == TimeCharacteristic.ProcessingTime) {
getConfig( ).setAutoWatermarkInterval(0);
} else {
getConfig().setAutoWatermarkInterval(200);
}
}
如果要修改這個WatermarkInterval時間:
(2)org.apache.flink.api.common.ExecutionConfig:
private long autoWatermarkInterval = 200;
// 可以通過這個方法來修改預設的WatermarkInterval
/**
* Sets the interval of the automatic watermark emission. Watermarks are used throughout
* the streaming system to keep track of the progress of time. They are used, for example,
* for time based windowing.
*
* <p>Setting an interval of {@code 0} will disable periodic watermark emission.
*
* @param interval The interval between watermarks in milliseconds.
*/
@PublicEvolving
public ExecutionConfig setAutoWatermarkInterval(long interval) {
Preconditions.checkArgument(interval >= 0, "Auto watermark interval must not be negative.");
this.autoWatermarkInterval = interval;
return this;
}