W - The type of Windows on which this trigger can operate.public class DeltaTrigger<T extends Serializable,W extends Window> extends Object implements Trigger<T,W>
Trigger that fires based on a DeltaFunction and a threshold.
This trigger calculates a delta between the data point which triggered last and the currently arrived data point. It triggers if the delta is higher than a specified threshold.
Trigger.TriggerContext, Trigger.TriggerResult| Modifier and Type | Method and Description |
|---|---|
static <T extends Serializable,W extends Window> |
of(double threshold,
DeltaFunction<T> deltaFunction)
Creates a delta trigger from the given threshold and
DeltaFunction. |
Trigger.TriggerResult |
onElement(T element,
long timestamp,
W window,
Trigger.TriggerContext ctx)
Called for every element that gets added to a pane.
|
Trigger.TriggerResult |
onEventTime(long time,
W window,
Trigger.TriggerContext ctx)
Called when an event-time timer that was set using the trigger context fires.
|
Trigger.TriggerResult |
onProcessingTime(long time,
W window,
Trigger.TriggerContext ctx)
Called when a processing-time timer that was set using the trigger context fires.
|
String |
toString() |
public Trigger.TriggerResult onElement(T element, long timestamp, W window, Trigger.TriggerContext ctx) throws Exception
TriggeronElement in interface Trigger<T extends Serializable,W extends Window>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.Exceptionpublic Trigger.TriggerResult onEventTime(long time, W window, Trigger.TriggerContext ctx)
TriggeronEventTime in interface Trigger<T extends Serializable,W extends Window>time - The timestamp at which the timer fired.ctx - A context object that can be used to register timer callbacks.public Trigger.TriggerResult onProcessingTime(long time, W window, Trigger.TriggerContext ctx) throws Exception
TriggeronProcessingTime in interface Trigger<T extends Serializable,W extends Window>time - The timestamp at which the timer fired.ctx - A context object that can be used to register timer callbacks.Exceptionpublic static <T extends Serializable,W extends Window> DeltaTrigger<T,W> of(double threshold, DeltaFunction<T> deltaFunction)
DeltaFunction.T - The type of elements on which this trigger can operate.W - The type of Windows on which this trigger can operate.threshold - The threshold at which to trigger.deltaFunction - The delta function to useCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.