Interface EventTrackerStatus
- All Known Implementing Classes:
AddedTrackerStatus,RemovedTrackerStatus,TrackerStatus,WrappedTrackerStatus
public interface EventTrackerStatus
Interface describing the status of a
Segment of a StreamingEventProcessor.- Since:
- 3.2
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionReturn the estimated relative current token position this Segment represents.getError()Returns the exception that caused processing to fail, if present.Return the relative position at which a reset was triggered for this Segment.The segment for which this status is valid.The tracking token of the last event that has been seen by this Segment.booleanWhether the Segment of this status has caught up with the head of the event stream.default booleandefault booleanisDifferent(EventTrackerStatus that, boolean validatePositions) booleanIndicates whether this status represents an error.booleanIndicates whether this Segment is still merging two (or more) Segments.booleanIndicates whether this Segment is still replaying previously processed Events.default booleanMatch the position fields ofthisandthat.default booleanMatch the boolean state fields ofthisandthat.Return the estimated relative token position this Segment will have after a merge operation is complete.default booleanReturns abooleandescribing whether thisEventTrackerStatusis starting it's progress for the first time.default booleanReturns abooleandescribing whether thisEventTrackerStatushas just stopped it's progress.
-
Method Details
-
getSegment
Segment getSegment()The segment for which this status is valid.- Returns:
- segment for which this status is valid
-
isCaughtUp
boolean isCaughtUp()Whether the Segment of this status has caught up with the head of the event stream. Note that this is no guarantee that this segment is still processing at (or near) real-time events. It merely indicates that this segment has been at the head of the stream since it started processing. It may have fallen back since then.- Returns:
- whether the Segment of this status has caught up with the head of the event stream
-
isReplaying
boolean isReplaying()Indicates whether this Segment is still replaying previously processed Events.Note that this method will only recognize a replay if the tokens have been reset using
StreamingEventProcessor.resetTokens(). Removing tokens directly from the underlyingTokenStorewill not be recognized as a replay.- Returns:
trueif this segment is replaying historic events after areset, otherwisefalse
-
isMerging
boolean isMerging()Indicates whether this Segment is still merging two (or more) Segments. The merging process will be done once all Segments have reached the same position.- Returns:
trueif this segment is merging Segments, otherwisefalse
-
mergeCompletedPosition
OptionalLong mergeCompletedPosition()Return the estimated relative token position this Segment will have after a merge operation is complete. Will return a non-empty result as long asisMerging()} returns true. In case no estimation can be given or no merge in progress, anOptionalLong.empty()will be returned.- Returns:
- return the estimated relative position this Segment will reach after a merge operation is complete.
-
getTrackingToken
TrackingToken getTrackingToken()The tracking token of the last event that has been seen by this Segment.The returned tracking token represents the position of this segment in the event stream. In case of a recent merge of segments, the token represents the lowest position of the two merged segments.
- Returns:
- tracking token of the last event that has been seen by this Segment
-
isErrorState
boolean isErrorState()Indicates whether this status represents an error. When this method returntrue, thegetError()will return the exception that caused the failure.- Returns:
trueif an error was reported, otherwisefalse
-
getError
Throwable getError()Returns the exception that caused processing to fail, if present. If the segment is being processed normally, this method returnsnull.- Returns:
- the exception that caused processing to fail, or
nullwhen processing normally
-
getCurrentPosition
OptionalLong getCurrentPosition()Return the estimated relative current token position this Segment represents. In case of replay is active, return the estimated relative position reached by merge operation. In case of merge is active, return the estimated relative position reached by merge operation. In case no estimation can be given, or no replay or merge in progress, anOptionalLong.empty()will be returned.- Returns:
- return the estimated relative current token position this Segment represents
-
getResetPosition
OptionalLong getResetPosition()Return the relative position at which a reset was triggered for this Segment. In case a replay finished or no replay is active, anOptionalLong.empty()will be returned.- Returns:
- the relative position at which a reset was triggered for this Segment
-
trackerAdded
default boolean trackerAdded()Returns abooleandescribing whether thisEventTrackerStatusis starting it's progress for the first time. Particularly useful if theEventTrackerStatusChangeListenershould react to added status'.- Returns:
trueif thisEventTrackerStatusjust started,falseotherwise
-
trackerRemoved
default boolean trackerRemoved()Returns abooleandescribing whether thisEventTrackerStatushas just stopped it's progress. Particularly useful if theEventTrackerStatusChangeListenershould react to removed status'.- Returns:
trueif thisEventTrackerStatuswas just removed,falseotherwise
-
isDifferent
- Parameters:
that- the otherEventTrackerStatusto validate the difference with- Returns:
trueif bothEventTrackerStatus's are different,falseotherwise
-
isDifferent
- Parameters:
that- the otherEventTrackerStatusto validate the difference withvalidatePositions- flag dictating whethermatchPositions(EventTrackerStatus)should be taken into account when matching- Returns:
trueif bothEventTrackerStatus's are different,falseotherwise
-
matchStates
Match the boolean state fields ofthisandthat. This meansisCaughtUp(),isReplaying(),isMerging()andisErrorState()are taken into account.- Parameters:
that- the otherEventTrackerStatusto match with- Returns:
trueif the boolean fields ofthisandthatmatch, otherwisefalse
-
matchPositions
Match the position fields ofthisandthat. This meansgetCurrentPosition(),getResetPosition()andmergeCompletedPosition()()} are taken into account.- Parameters:
that- the otherEventTrackerStatusto match with- Returns:
trueif the positions fields ofthisandthatmatch, otherwisefalse
-