W - The type of windows being triggered/encoded.@Experimental(value=TRIGGER) public class DefaultTrigger<W extends BoundedWindow> extends Trigger<W>
Repeatedly.forever(AfterWatermark.pastEndOfWindow()).
See Repeatedly.forever(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>) and AfterWatermark.pastEndOfWindow() for more details.Trigger.MergeResult, Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.OnTimerContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>, Trigger.TriggerResultsubTriggers| Modifier and Type | Method and Description |
|---|---|
void |
clear(Trigger.TriggerContext c)
Clear any state associated with this trigger in the given window.
|
Trigger<W> |
getContinuationTrigger(List<Trigger<W>> continuationTriggers)
Return the
Trigger.getContinuationTrigger() of this Trigger. |
org.joda.time.Instant |
getWatermarkThatGuaranteesFiring(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. |
static <W extends BoundedWindow> |
of()
Returns the default trigger.
|
Trigger.TriggerResult |
onElement(Trigger.OnElementContext c)
Called immediately after an element is first incorporated into a window.
|
Trigger.MergeResult |
onMerge(Trigger.OnMergeContext c)
Called immediately after windows have been merged.
|
Trigger.TriggerResult |
onTimer(Trigger.OnTimerContext c)
Called when a timer has fired for the current window.
|
equals, getContinuationTrigger, hashCode, orFinally, prefetchOnElement, prefetchOnMerge, prefetchOnTimer, subTriggers, toStringpublic static <W extends BoundedWindow> DefaultTrigger<W> of()
public Trigger.TriggerResult onElement(Trigger.OnElementContext c) throws Exception
TriggeronElement in class Trigger<W extends BoundedWindow>Exceptionpublic Trigger.MergeResult onMerge(Trigger.OnMergeContext c) throws Exception
Trigger Leaf triggers should determine their result by inspecting their status and any state
in the merging windows. Composite triggers should determine their result by calling
ExecutableTrigger.invokeMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) on their sub-triggers, and applying appropriate logic.
A trigger can only return Trigger.MergeResult.ALREADY_FINISHED if it is marked as finished
in at least one of the windows being merged.
The implementation does not need to clear out any state associated with the old windows.
onMerge in class Trigger<W extends BoundedWindow>Exceptionpublic Trigger.TriggerResult onTimer(Trigger.OnTimerContext c) throws Exception
TriggeronTimer in class Trigger<W extends BoundedWindow>Exceptionpublic void clear(Trigger.TriggerContext c) throws 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>Exceptionpublic org.joda.time.Instant getWatermarkThatGuaranteesFiring(W window)
Trigger For triggers that do not fire based on the watermark advancing, returns
BoundedWindow.TIMESTAMP_MAX_VALUE.
This estimate is used to determine that there are no elements in a side-input window, which causes the default value to be used instead.
getWatermarkThatGuaranteesFiring in class Trigger<W extends BoundedWindow>public boolean isCompatible(Trigger<?> other)
TriggerTrigger.isCompatible in class Trigger<W extends BoundedWindow>public Trigger<W> getContinuationTrigger(List<Trigger<W>> continuationTriggers)
TriggerTrigger.getContinuationTrigger() of this Trigger. For convenience, this
is provided the continuation trigger of each of the sub-triggers.getContinuationTrigger in class Trigger<W extends BoundedWindow>