Class Repeatedly

java.lang.Object
org.apache.beam.sdk.transforms.windowing.Trigger
org.apache.beam.sdk.transforms.windowing.Repeatedly
All Implemented Interfaces:
Serializable

public class Repeatedly extends Trigger
A Trigger that fires according to its subtrigger forever.

For example, to fire after the end of the window, and every time late data arrives:


 Repeatedly.forever(AfterWatermark.pastEndOfWindow());
 

Repeatedly.forever(someTrigger) behaves like an infinite AfterEach.inOrder(someTrigger, someTrigger, someTrigger, ...).

You can use Trigger.orFinally(OnceTrigger) to let another trigger interrupt the repetition.

See Also:
  • Method Details

    • forever

      public static Repeatedly forever(Trigger repeated)
      Create a composite trigger that repeatedly executes the trigger repeated, firing each time it fires and ignoring any indications to finish.

      Unless used with Trigger.orFinally(org.apache.beam.sdk.transforms.windowing.Trigger.OnceTrigger) the composite trigger will never finish.

      Parameters:
      repeated - the trigger to execute repeatedly.
    • getRepeatedTrigger

      public Trigger getRepeatedTrigger()
    • getWatermarkThatGuaranteesFiring

      public Instant getWatermarkThatGuaranteesFiring(BoundedWindow window)
      Description copied from class: Trigger
      For internal use only; no backwards-compatibility guarantees.

      Returns a bound in event time by which this trigger would have fired at least once for a given window had there been input data.

      For triggers that do not fire based on the watermark advancing, returns BoundedWindow.TIMESTAMP_MAX_VALUE.

      This estimate may be used, for example, to determine that there are no elements in a side-input window, which causes the default value to be used instead.

      Specified by:
      getWatermarkThatGuaranteesFiring in class Trigger
    • mayFinish

      public boolean mayFinish()
      Description copied from class: Trigger
      For internal use only; no backwards-compatibility guarantees.

      Indicates whether this trigger may "finish". A top level trigger that finishes can cause data loss, so is rejected by GroupByKey validation.

      Specified by:
      mayFinish in class Trigger
    • getContinuationTrigger

      protected Trigger getContinuationTrigger(List<Trigger> continuationTriggers)
      Description copied from class: Trigger
      Subclasses should override this to return the Trigger.getContinuationTrigger() of this Trigger. For convenience, this is provided the continuation trigger of each of the sub-triggers in the same order as Trigger.subTriggers.
      Specified by:
      getContinuationTrigger in class Trigger
      Parameters:
      continuationTriggers - contains the result of Trigger.getContinuationTrigger() on each of the subTriggers in the same order.
    • toString

      public String toString()
      Overrides:
      toString in class Trigger