hi Good morning, afternoon and evening, i have a q...
# troubleshooting
t
hi Good morning, afternoon and evening, i have a question on
EventTimeTrigger
from flink
Copy code
@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;
        }
    }
suppose there are 5 elements of a same window got into
onElement
function and hit the
registerEventTimeTimer
five times, will the
onEventTime
get invoke 5 times ?
e
It depends on the type of window. If the trigger is working on say, a
TumblingWindow
which has a fixed start and end,
window.maxTimestamp()
will be the same for all 5 elements in the window so
onEventTime
will be called only once. For a
SessionWindow
which gets extended if it receives an element within a certain time,
onEventTime
can be invoked up to 5 times. If the 5 events arrive in order and the timestamps are all different then
onEventTime
will be invoked 5 times.
πŸ™ 1
t
thanks Elphas for the detail explanation with example