Hi all,

I want to be sure about when EventTimeTrigger.onEventTime() method is
called with event-time session windows.
It returns TriggerResult.FIRE only when the timestamp of the registered
timer equals to the max timestamp of the current window:

@Override
public TriggerResult onEventTime(long time, TimeWindow window,
TriggerContext ctx) {
return time == window.maxTimestamp() ?
TriggerResult.FIRE :
TriggerResult.CONTINUE;
}

As far as I understand, when EventTimeTrigger is used with event-time
session window, there's no chance of EventTimeTrigger.onEventTime being
called with time != window.maxTimestamp.
Is it true? If not, could anyone let me know the corner case?

The reason why I'm asking is because I want to register an event-time timer
when my custom trigger receives a special event which signifies the end of
a session.
The timestamp of the registered timer is not going to be equal to
window.maxTimestamp and I want to return Trigger.Result.FIRE_AND_PURGE in
such a case.
As I also want to purge the content of a window when it expires,
onEventTime should look like this:

@Override
public TriggerResult onEventTime(long time, TimeWindow window,
TriggerContext ctx) {
return TriggerResult.FIRE_AND_PURGE;
}

It will return FIRE_AND_PURGE every time MyTrigger.onEventTime is called.
It looks quite dangerous and I'm not quite sure about that.

- Dongwon

Reply via email to