Interface EventExaminer<EventT,StateT extends MutableState<EventT,?>>
-
- Type Parameters:
EventT-StateT-
- All Superinterfaces:
java.io.Serializable
public interface EventExaminer<EventT,StateT extends MutableState<EventT,?>> extends java.io.SerializableClasses extending this interface will be called byOrderedEventProcessorto examine every incoming event.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull StateTcreateStateOnInitialEvent(EventT event)If the event was the first event for a given key, create the state to hold the required data needed for processing.booleanisInitialEvent(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.booleanisLastEvent(long sequenceNumber, EventT event)Is this event the last expected event for a given key and window?
-
-
-
Method Detail
-
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 toOrderedEventProcessorevent- 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 eventevent- 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.
-
-