Google Cloud Dataflow SDK for Java, version 1.9.1
com.google.cloud.dataflow.sdk.transforms.windowing
Class Trigger.OnceTrigger<W extends BoundedWindow>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>
-
- com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.OnceTrigger<W>
-
- Type Parameters:
W
-BoundedWindow
subclass used to represent the windows used by thisAtMostOnceTrigger
- All Implemented Interfaces:
- TriggerBuilder<W>, Serializable
- Direct Known Subclasses:
- AfterAll, AfterDelayFromFirstElement, AfterFirst, AfterPane, AfterWatermark.FromEndOfWindow
- Enclosing class:
- Trigger<W extends BoundedWindow>
public abstract static class Trigger.OnceTrigger<W extends BoundedWindow> extends Trigger<W>
Trigger
s that are guaranteed to fire at most once should extend from this, rather than the generalTrigger
class to indicate that behavior.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>
-
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
subTriggers
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
OnceTrigger(List<Trigger<W>> subTriggers)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description Trigger.OnceTrigger<W>
getContinuationTrigger()
Return a trigger to use after aGroupByKey
to preserve the intention of this trigger.void
onFire(Trigger.TriggerContext context)
Adjusts the state of the trigger to be ready for the next pane.protected abstract void
onOnlyFiring(Trigger.TriggerContext context)
Called exactly once byonFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
when the trigger is fired.-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
buildTrigger, clear, equals, getContinuationTrigger, getWatermarkThatGuaranteesFiring, hashCode, isCompatible, onElement, onMerge, orFinally, prefetchOnElement, prefetchOnFire, prefetchOnMerge, prefetchShouldFire, shouldFire, subTriggers, toString
-
-
-
-
Method Detail
-
getContinuationTrigger
public final Trigger.OnceTrigger<W> getContinuationTrigger()
Description copied from class:Trigger
Return a trigger to use after aGroupByKey
to preserve the intention of this trigger. Specifically, triggers that are time based and intended to provide speculative results should continue providing speculative results. Triggers that fire once (or multiple times) should continue firing once (or multiple times).- Overrides:
getContinuationTrigger
in classTrigger<W extends BoundedWindow>
-
onFire
public final void onFire(Trigger.TriggerContext context) throws Exception
Adjusts the state of the trigger to be ready for the next pane. For example, aRepeatedly
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
.- Specified by:
onFire
in classTrigger<W extends BoundedWindow>
- Throws:
Exception
-
onOnlyFiring
protected abstract void onOnlyFiring(Trigger.TriggerContext context) throws Exception
Called exactly once byonFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
when the trigger is fired. By default, invokesonFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
on all subtriggers for whichTrigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
istrue
.- Throws:
Exception
-
-