I want to have a time window to trigger data processing in two following
condition:
1 - The window has 3 messages
2- Or any number of message (less than 3) is in the window and it reaches a
timeout

I know someone should extend Trigger class:

public static class MyWindowTrigger <W extends Window> extends
Trigger<Object, W> {

    @Override
    public TriggerResult onElement(Object o, long l, W w,
TriggerContext triggerContext) throws Exception {

    }

    @Override
    public TriggerResult onProcessingTime(long l, W w, TriggerContext
triggerContext) throws Exception {
        return TriggerResult.CONTINUE ;
    }

    @Override
    public TriggerResult onEventTime(long l, W w, TriggerContext
triggerContext) throws Exception {
        return TriggerResult.CONTINUE ;
    }

    @Override
    public void clear(W w, TriggerContext triggerContext) throws Exception {

    }

But I don't know how should I check the number of messages in the window
and set a timeout. Can someone help?

Reply via email to