W - BoundedWindow subclass used to represent the windows used@Experimental(value=TRIGGER) public class AfterProcessingTime<W extends BoundedWindow> extends TimeTrigger<W>
AfterProcessingTime triggers fire based on the current processing time. They operate in
the real-time domain.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.TriggerResultDELAYED_UNTIL_TAG, IDENTITY, timestampMapperssubTriggers| Modifier and Type | Method and Description |
|---|---|
void |
clear(Trigger.TriggerContext c)
Clear any state associated with this trigger in the given window.
|
boolean |
equals(Object obj) |
protected 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.
|
int |
hashCode() |
protected AfterProcessingTime<W> |
newWith(List<SerializableFunction<org.joda.time.Instant,org.joda.time.Instant>> transforms)
Method to create an updated version of this
TimeTrigger modified to use the specified
transform. |
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.
|
static <W extends BoundedWindow> |
pastFirstElementInPane()
Creates a trigger that fires when the current processing time passes the processing time
at which this trigger saw the first element in a pane.
|
void |
prefetchOnElement(com.google.cloud.dataflow.sdk.util.ReduceFn.StateContext state)
Called to allow the trigger to prefetch any state it will likely need to read from during
an
Trigger.onElement(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnElementContext) call. |
void |
prefetchOnMerge(com.google.cloud.dataflow.sdk.util.ReduceFn.MergingStateContext state)
Called to allow the trigger to prefetch any state it will likely need to read from during
an
Trigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) call. |
void |
prefetchOnTimer(com.google.cloud.dataflow.sdk.util.ReduceFn.StateContext state)
Called to allow the trigger to prefetch any state it will likely need to read from during
an
Trigger.onTimer(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnTimerContext) call. |
String |
toString() |
alignedTo, alignedTo, computeTargetTimestamp, isCompatible, mappedTo, plusDelayOfgetContinuationTriggerbuildTrigger, orFinally, subTriggerspublic static <W extends BoundedWindow> AfterProcessingTime<W> pastFirstElementInPane()
protected AfterProcessingTime<W> newWith(List<SerializableFunction<org.joda.time.Instant,org.joda.time.Instant>> transforms)
TimeTriggerTimeTrigger modified to use the specified
transform.newWith in class TimeTrigger<W extends BoundedWindow>transforms - The new transform to apply to target times.TimeTrigger.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
TriggerLeaf 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 prefetchOnElement(com.google.cloud.dataflow.sdk.util.ReduceFn.StateContext state)
TriggerTrigger.onElement(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnElementContext) call.prefetchOnElement in class Trigger<W extends BoundedWindow>state - StateContext to prefetch from.public void prefetchOnMerge(com.google.cloud.dataflow.sdk.util.ReduceFn.MergingStateContext state)
TriggerTrigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) call.prefetchOnMerge in class Trigger<W extends BoundedWindow>state - StateContext to prefetch from.public void prefetchOnTimer(com.google.cloud.dataflow.sdk.util.ReduceFn.StateContext state)
TriggerTrigger.onTimer(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnTimerContext) call.prefetchOnTimer in class Trigger<W extends BoundedWindow>state - StateContext to prefetch from.public 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)
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>protected 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 String toString()
toString in class Trigger<W extends BoundedWindow>public boolean equals(Object obj)
equals in class Trigger<W extends BoundedWindow>public int hashCode()
hashCode in class Trigger<W extends BoundedWindow>