Java Code Examples for org.apache.flink.streaming.api.windowing.triggers.TriggerResult#FIRE
The following examples show how to use
org.apache.flink.streaming.api.windowing.triggers.TriggerResult#FIRE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception { if (window.maxTimestamp() <= ctx.getCurrentWatermark()) { // if the watermark is already past the window fire immediately return TriggerResult.FIRE; } else { ctx.registerEventTimeTimer(window.maxTimestamp()); return TriggerResult.CONTINUE; } }
Example 2
Source File: WindowOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Override public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception { if (window.maxTimestamp() <= ctx.getCurrentWatermark()) { // if the watermark is already past the window fire immediately return TriggerResult.FIRE; } else { ctx.registerEventTimeTimer(window.maxTimestamp()); return TriggerResult.CONTINUE; } }
Example 3
Source File: CustomWindow.java From examples-java with Apache License 2.0 | 5 votes |
@Override public TriggerResult onEventTime(long ts, TimeWindow w, TriggerContext ctx) throws Exception { if (ts == w.getEnd()) { // final evaluation and purge window state return TriggerResult.FIRE_AND_PURGE; } else { // register next early firing timer long t = ctx.getCurrentWatermark() + (1000 - (ctx.getCurrentWatermark() % 1000)); if (t < w.getEnd()) { ctx.registerEventTimeTimer(t); } // fire trigger to early evaluate window return TriggerResult.FIRE; } }
Example 4
Source File: WindowOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Override public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) throws Exception { if (window.maxTimestamp() <= ctx.getCurrentWatermark()) { // if the watermark is already past the window fire immediately return TriggerResult.FIRE; } else { ctx.registerEventTimeTimer(window.maxTimestamp()); return TriggerResult.CONTINUE; } }
Example 5
Source File: AdvertisingTopologyFlinkWindows.java From yahoo-streaming-benchmark with Apache License 2.0 | 4 votes |
@Override public TriggerResult onProcessingTime(long time, TimeWindow window, TriggerContext ctx) throws Exception { // schedule next timer ctx.registerProcessingTimeTimer(System.currentTimeMillis() + 1000L); return TriggerResult.FIRE; }
Example 6
Source File: DrivingSegments.java From flink-training-exercises with Apache License 2.0 | 4 votes |
@Override public TriggerResult onEventTime(long time, GlobalWindow window, TriggerContext ctx) { return TriggerResult.FIRE; }