最近做的实验涉及到Flnik的时间戳机制,系统的总结一下Flink的time机制
一、Flink中timestamp和watermark使用
-
在数据源中指定时间戳和水位线
@Override public void run(SourceContext<MyType> ctx) throws Exception { while (/* condition */) { MyType next = getNext(); //指定时间戳 ctx.collectWithTimestamp(next, next.getEventTimestamp()); if (next.hasWatermarkTime()) { //指定水位线 ctx.emitWatermark(new Watermark(next