W - BoundedWindow subclass used to represent the windows used by this
Triggerpublic class Repeatedly<W extends BoundedWindow> extends Trigger<W>
For example, to fire after the end of the window, and every time late data arrives:
Repeatedly.forever(AfterWatermark.isPastEndOfWindow());
Repeatedly.forever(someTrigger) behaves like the infinite
SequenceOf(someTrigger, someTrigger, someTrigger, ...).
Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementEvent<W>, Trigger.OnMergeEvent<W>, Trigger.OnTimerEvent<W extends BoundedWindow>, Trigger.TimeDomain, Trigger.TriggerContext<W extends BoundedWindow>, Trigger.TriggerId<W extends BoundedWindow>, Trigger.TriggerResult, Trigger.WindowStatus| Modifier and Type | Method and Description |
|---|---|
void |
clear(Trigger.TriggerContext<W> c,
W window)
Clear any state associated with this trigger in the given window.
|
static <W extends BoundedWindow> |
forever(Trigger<W> repeated)
Create a composite trigger that repeatedly executes the trigger
toRepeat, firing each
time it fires and ignoring any indications to finish. |
Instant |
getWatermarkCutoff(W window)
Returns a bound in watermark time by which this trigger would have fired at least once
for a given window had there been input data.
|
boolean |
isCompatible(Trigger<?> other)
Returns whether this performs the same triggering as the given
Trigger. |
Trigger.TriggerResult |
onElement(Trigger.TriggerContext<W> c,
Trigger.OnElementEvent<W> e)
Called immediately after an element is first incorporated into a window.
|
Trigger.TriggerResult |
onMerge(Trigger.TriggerContext<W> c,
Trigger.OnMergeEvent<W> e)
Called immediately after windows have been merged.
|
Trigger.TriggerResult |
onTimer(Trigger.TriggerContext<W> c,
Trigger.OnTimerEvent<W> e)
Called when a timer has fired for the trigger or one of it’s sub-triggers.
|
boolean |
willNeverFinish()
Return true if the trigger is guaranteed to never finish.
|
public static <W extends BoundedWindow> Repeatedly<W> forever(Trigger<W> repeated)
toRepeat, firing each
time it fires and ignoring any indications to finish.
Unless used with Trigger.orFinally(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.OnceTrigger<W>) the composite trigger will never finish.
repeated - the trigger to execute repeatedly.public Trigger.TriggerResult onElement(Trigger.TriggerContext<W> c, Trigger.OnElementEvent<W> e) throws java.lang.Exception
TriggeronElement in class Trigger<W extends BoundedWindow>c - the context to interact withe - an event describing the cause of this callback being executedjava.lang.Exceptionpublic Trigger.TriggerResult onMerge(Trigger.TriggerContext<W> c, Trigger.OnMergeEvent<W> e) throws java.lang.Exception
TriggerThis will only be called if the trigger hasn't finished in any of the oldWindows.
If it had finished, we assume that it is also finished in the resulting window.
The implementation does not need to clear out any state associated with the old windows. That will automatically be done by the trigger execution layer.
onMerge in class Trigger<W extends BoundedWindow>c - the context to interact withe - an event describnig the cause of this callback being executedjava.lang.Exceptionpublic Trigger.TriggerResult onTimer(Trigger.TriggerContext<W> c, Trigger.OnTimerEvent<W> e) throws java.lang.Exception
TriggeronTimer in class Trigger<W extends BoundedWindow>c - the context to interact withe - identifier for the trigger that the timer is for.java.lang.Exceptionpublic void clear(Trigger.TriggerContext<W> c, W window) throws java.lang.Exception
TriggerThis is called after a trigger has indicated it will never fire again. The trigger system keeps enough information to know that the trigger is finished, so this trigger should clear all of its state.
clear in class Trigger<W extends BoundedWindow>c - the context to interact withwindow - the window that is being clearedjava.lang.Exceptionpublic boolean willNeverFinish()
TriggerwillNeverFinish in class Trigger<W extends BoundedWindow>public Instant getWatermarkCutoff(W window)
Trigger For triggers that do not fire based on the watermark advancing, returns
BoundedWindow.TIMESTAMP_MAX_VALUE.
getWatermarkCutoff in class Trigger<W extends BoundedWindow>public boolean isCompatible(Trigger<?> other)
TriggerTrigger.isCompatible in class Trigger<W extends BoundedWindow>