W - BoundedWindow subclass used to represent the windows used by this
Trigger@Experimental(value=TRIGGER) public class AfterEach<W extends BoundedWindow> extends Trigger<W>
Trigger that executes its sub-triggers in order.
Only one sub-trigger is executing at a time,
and any time it fires the AfterEach fires. When the currently executing
sub-trigger finishes, the AfterEach starts executing the next sub-trigger.
AfterEach.inOrder(t1, t2, ...) finishes when all of the sub-triggers have finished.
The following properties hold:
AfterEach.inOrder(AfterEach.inOrder(a, b), c) behaves the same as
AfterEach.inOrder(a, b, c) and AfterEach.inOrder(a, AfterEach.inOrder(b, c).
AfterEach.inOrder(Repeatedly.forever(a), b) behaves the same as
Repeatedly.forever(a), since the repeated trigger never finishes.
Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>subTriggers| Modifier and Type | Method and Description |
|---|---|
Trigger<W> |
getContinuationTrigger(List<Trigger<W>> continuationTriggers)
Return the
Trigger.getContinuationTrigger() of this Trigger. |
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.
|
static <W extends BoundedWindow> |
inOrder(Trigger<W>... triggers)
Returns an
AfterEach Trigger with the given subtriggers. |
void |
onElement(Trigger.OnElementContext c)
Called immediately after an element is first incorporated into a window.
|
void |
onFire(Trigger.TriggerContext context)
Adjusts the state of the trigger to be ready for the next pane.
|
void |
onMerge(Trigger.OnMergeContext context)
Called immediately after windows have been merged.
|
boolean |
shouldFire(Trigger.TriggerContext context)
Returns
true if the current state of the trigger indicates that its condition
is satisfied and it is ready to fire. |
String |
toString() |
buildTrigger, clear, equals, getContinuationTrigger, hashCode, isCompatible, orFinally, prefetchOnElement, prefetchOnFire, prefetchOnMerge, prefetchShouldFire, subTriggers@SafeVarargs public static <W extends BoundedWindow> Trigger<W> inOrder(Trigger<W>... triggers)
AfterEach Trigger with the given subtriggers.public void onElement(Trigger.OnElementContext c) throws Exception
TriggeronElement in class Trigger<W extends BoundedWindow>Exceptionpublic void onMerge(Trigger.OnMergeContext context) throws Exception
TriggerLeaf triggers should update their state by inspecting their status and any state
in the merging windows. Composite triggers should update their state by calling
ExecutableTrigger.invokeOnMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) on their sub-triggers, and applying appropriate logic.
A trigger such as AfterWatermark.pastEndOfWindow() may no longer be finished;
it is the responsibility of the trigger itself to record this fact. It is forbidden for
a trigger to become finished due to Trigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext), as it has not yet fired the pending
elements that led to it being ready to fire.
The implementation does not need to clear out any state associated with the old windows.
onMerge in class Trigger<W extends BoundedWindow>Exceptionpublic Instant getWatermarkThatGuaranteesFiring(W window)
TriggerFor 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 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>public boolean shouldFire(Trigger.TriggerContext context) throws Exception
Triggertrue if the current state of the trigger indicates that its condition
is satisfied and it is ready to fire.shouldFire in class Trigger<W extends BoundedWindow>Exceptionpublic void onFire(Trigger.TriggerContext context) throws Exception
TriggerRepeatedly trigger will reset its inner trigger, since it has fired.
If the trigger is finished, it is the responsibility of the trigger itself to
record that fact via the context.
onFire in class Trigger<W extends BoundedWindow>Exceptionpublic String toString()
toString in class Trigger<W extends BoundedWindow>