Out of curiosity, why don't you want to keep it like this?

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

I mean checking for the maxTimestamp().

Best,
Aljoscha

> On 23. Jul 2018, at 16:10, 김동원 <eastcirc...@gmail.com> wrote:
> 
> Hi Aljoscha,
> 
> If that is the only case, I need to return TriggerResult.CONTINUE when time > 
> window.maxTimestamp.
> 
> It is very fortunate that onEventTime is not called when time < 
> window.maxTimestamp except my timer.
> 
> Thanks a lot for your quick reply.
> 
> Best,
> 
> - Dongwon
> 
> 2018. 7. 23. 오후 10:58, Aljoscha Krettek <aljos...@apache.org 
> <mailto:aljos...@apache.org>> 작성:
> 
>> Hi,
>> 
>> If you set an allowed lateness that is greater than zero you will get 
>> another call to onEventTime() on window.maxTimestamp + allowedLateness.
>> 
>> Does that help answer your question?
>> 
>> Best,
>> Aljoscha
>> 
>>> On 23. Jul 2018, at 15:40, Dongwon Kim <eastcirc...@gmail.com 
>>> <mailto:eastcirc...@gmail.com>> wrote:
>>> 
>>> 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