@PublicEvolving public class EventTimeTrigger extends Trigger<Object,TimeWindow>
Trigger
that fires once the watermark passes the end of the window
to which a pane belongs.Watermark
,
Serialized FormTrigger.TriggerContext
Modifier and Type | Method and Description |
---|---|
void |
clear(TimeWindow window,
Trigger.TriggerContext ctx)
Clears any state that the trigger might still hold for the given window.
|
static EventTimeTrigger |
create()
Creates an event-time trigger that fires once the watermark passes the end of the window.
|
TriggerResult |
onElement(Object element,
long timestamp,
TimeWindow window,
Trigger.TriggerContext ctx)
Called for every element that gets added to a pane.
|
TriggerResult |
onEventTime(long time,
TimeWindow window,
Trigger.TriggerContext ctx)
Called when an event-time timer that was set using the trigger context fires.
|
TriggerResult |
onProcessingTime(long time,
TimeWindow window,
Trigger.TriggerContext ctx)
Called when a processing-time timer that was set using the trigger context fires.
|
String |
toString() |
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, Trigger.TriggerContext ctx) throws Exception
Trigger
onElement
in class Trigger<Object,TimeWindow>
element
- The element that arrived.timestamp
- The timestamp of the element that arrived.window
- The window to which this pane belongs.ctx
- A context object that can be used to register timer callbacks.Exception
public TriggerResult onEventTime(long time, TimeWindow window, Trigger.TriggerContext ctx)
Trigger
onEventTime
in class Trigger<Object,TimeWindow>
time
- The timestamp at which the timer fired.ctx
- A context object that can be used to register timer callbacks.public TriggerResult onProcessingTime(long time, TimeWindow window, Trigger.TriggerContext ctx) throws Exception
Trigger
onProcessingTime
in class Trigger<Object,TimeWindow>
time
- The timestamp at which the timer fired.ctx
- A context object that can be used to register timer callbacks.Exception
public void clear(TimeWindow window, Trigger.TriggerContext ctx) throws Exception
Trigger
Trigger.TriggerContext.registerEventTimeTimer(long)
and Trigger.TriggerContext.registerProcessingTimeTimer(long)
should be deleted here as
well as state acquired using Trigger.TriggerContext.getPartitionedState(StateDescriptor)
.
By default, this method does nothing.
clear
in class Trigger<Object,TimeWindow>
Exception
public static EventTimeTrigger create()
Once the trigger fires all elements are discarded. Elements that arrive late immediately trigger window evaluation with just this one element.
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.