Interface Watch.Growth.TerminationCondition<InputT,StateT>

All Superinterfaces:
Serializable
Enclosing class:
Watch.Growth<InputT,OutputT,KeyT>

public static interface Watch.Growth.TerminationCondition<InputT,StateT> extends Serializable
A strategy for determining whether it is time to stop polling the current input regardless of whether its output is complete or not.

Some built-in termination conditions are Watch.Growth.never(), Watch.Growth.afterTotalOf(org.joda.time.ReadableDuration) and Watch.Growth.afterTimeSinceNewOutput(org.joda.time.ReadableDuration). Conditions can be combined using Watch.Growth.eitherOf(org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<InputT, FirstStateT>, org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<InputT, SecondStateT>) and Watch.Growth.allOf(org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<InputT, FirstStateT>, org.apache.beam.sdk.transforms.Watch.Growth.TerminationCondition<InputT, SecondStateT>). Users can also develop custom termination conditions, for example, one might imagine a condition that terminates after a given time after the first output appears for the input (unlike Watch.Growth.afterTotalOf(org.joda.time.ReadableDuration) which operates relative to when the input itself arrives).

A Watch.Growth.TerminationCondition is provided to Watch.Growth.withTerminationPerInput(TerminationCondition) and is used to maintain an independent state of the termination condition for every input, represented as StateT which must be immutable, non-null, and encodable via getStateCoder().

All functions take the wall-clock timestamp as Instant for convenience of unit-testing custom termination conditions.