W
- type of windowpublic static final class ProcessingTimeTriggers.AfterFirstElementPeriodic<W extends Window> extends WindowTrigger<W>
Trigger.OnMergeContext, Trigger.TriggerContext
ctx
Modifier and Type | Method and Description |
---|---|
boolean |
canMerge()
Returns true if this trigger supports merging of trigger state and can therefore.
|
void |
clear(W window)
Clears any state that the trigger might still hold for the given window.
|
boolean |
onElement(Object element,
long timestamp,
W window)
Called for every element that gets added to a pane.
|
boolean |
onEventTime(long time,
W window)
Called when an event-time timer that was set using the trigger context fires.
|
void |
onMerge(W window,
Trigger.OnMergeContext mergeContext)
Called when several windows have been merged into one window by the
WindowAssigner . |
boolean |
onProcessingTime(long time,
W window)
Called when a processing-time timer that was set using the trigger context fires.
|
void |
open(Trigger.TriggerContext ctx)
Initialization method for the trigger.
|
String |
toString() |
triggerTime
public void open(Trigger.TriggerContext ctx) throws Exception
Trigger
public boolean onElement(Object element, long timestamp, W window) throws Exception
Trigger
public boolean onProcessingTime(long time, W window) throws Exception
Trigger
Note: This method is not called in case the window does not contain any elements. Thus, if
you return PURGE
from a trigger method and you expect to do cleanup in a future
invocation of a timer callback it might be wise to clean any state that you would clean in
the timer callback.
onProcessingTime
in class Trigger<W extends Window>
time
- The timestamp at which the timer fired.window
- The window for which the timer fired.Exception
public boolean onEventTime(long time, W window) throws Exception
Trigger
Note: This method is not called in case the window does not contain any elements. Thus, if
you return PURGE
from a trigger method and you expect to do cleanup in a future
invocation of a timer callback it might be wise to clean any state that you would clean in
the timer callback.
onEventTime
in class Trigger<W extends Window>
time
- The timestamp at which the timer fired.window
- The window for which the timer fired.Exception
public boolean canMerge()
Trigger
If this returns true
you must properly implement Trigger.onMerge(Window,
OnMergeContext)
public void onMerge(W window, Trigger.OnMergeContext mergeContext) throws Exception
Trigger
WindowAssigner
.public void clear(W window) throws Exception
Trigger
Trigger.TriggerContext.registerEventTimeTimer(long)
and
Trigger.TriggerContext.registerProcessingTimeTimer(long)
should be deleted here as well as
state acquired using TriggerContext#getPartitionedState(StateDescriptor)
.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.