Interface EventExaminer<EventT,StateT extends MutableState<EventT,?>>

Type Parameters:
EventT -
StateT -
All Superinterfaces:
Serializable

public interface EventExaminer<EventT,StateT extends MutableState<EventT,?>> extends Serializable
Classes extending this interface will be called by OrderedEventProcessor to examine every incoming event.
  • Method Summary

    Modifier and Type
    Method
    Description
    If the event was the first event for a given key, create the state to hold the required data needed for processing.
    boolean
    isInitialEvent(long sequenceNumber, EventT event)
    Is this event the first expected event for the given key and window if the per key sequence is used? In case of global sequence it determines the first global sequence event.
    boolean
    isLastEvent(long sequenceNumber, EventT event)
    Is this event the last expected event for a given key and window?
  • Method Details

    • isInitialEvent

      boolean isInitialEvent(long sequenceNumber, EventT event)
      Is this event the first expected event for the given key and window if the per key sequence is used? In case of global sequence it determines the first global sequence event.
      Parameters:
      sequenceNumber - the sequence number of the event as defined by the key of the input PCollection to OrderedEventProcessor
      event - being processed
      Returns:
      true if this is the initial sequence.
    • createStateOnInitialEvent

      @NonNull StateT createStateOnInitialEvent(EventT event)
      If the event was the first event for a given key, create the state to hold the required data needed for processing. This data will be persisted in a Beam state.
      Parameters:
      event - the first event in the sequence.
      Returns:
      the state to persist.
    • isLastEvent

      boolean isLastEvent(long sequenceNumber, EventT event)
      Is this event the last expected event for a given key and window?

      Note, this method is not used yet with global sequences.

      Parameters:
      sequenceNumber - of the event
      event - being processed
      Returns:
      true if the last event. There are cases where it's impossible to know whether it's the last event. False should be returned in those cases.