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 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 underlying TokenStore will not be recognized as a replay.

      Returns:
      true if this segment is replaying historic events after a reset, otherwise false
    • 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:
      true if this segment is merging Segments, otherwise false
    • 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 as isMerging() } returns true. In case no estimation can be given or no merge in progress, an OptionalLong.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 return true, the getError() will return the exception that caused the failure.
      Returns:
      true if an error was reported, otherwise false
    • getError

      Throwable getError()
      Returns the exception that caused processing to fail, if present. If the segment is being processed normally, this method returns null.
      Returns:
      the exception that caused processing to fail, or null when 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, an OptionalLong.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, an OptionalLong.empty() will be returned.
      Returns:
      the relative position at which a reset was triggered for this Segment
    • trackerAdded

      default boolean trackerAdded()
      Returns a boolean describing whether this EventTrackerStatus is starting it's progress for the first time. Particularly useful if the EventTrackerStatusChangeListener should react to added status'.
      Returns:
      true if this EventTrackerStatus just started, false otherwise
    • trackerRemoved

      default boolean trackerRemoved()
      Returns a boolean describing whether this EventTrackerStatus has just stopped it's progress. Particularly useful if the EventTrackerStatusChangeListener should react to removed status'.
      Returns:
      true if this EventTrackerStatus was just removed, false otherwise
    • isDifferent

      default boolean isDifferent(EventTrackerStatus that)
      Check whether this EventTrackerStatus is different from that.
      Parameters:
      that - the other EventTrackerStatus to validate the difference with
      Returns:
      true if both EventTrackerStatus's are different, false otherwise
    • isDifferent

      default boolean isDifferent(EventTrackerStatus that, boolean validatePositions)
      Check whether this EventTrackerStatus is different from that.
      Parameters:
      that - the other EventTrackerStatus to validate the difference with
      validatePositions - flag dictating whether matchPositions(EventTrackerStatus) should be taken into account when matching
      Returns:
      true if both EventTrackerStatus's are different, false otherwise
    • matchStates

      default boolean matchStates(EventTrackerStatus that)
      Match the boolean state fields of this and that. This means isCaughtUp(), isReplaying(), isMerging() and isErrorState() are taken into account.
      Parameters:
      that - the other EventTrackerStatus to match with
      Returns:
      true if the boolean fields of this and that match, otherwise false
    • matchPositions

      default boolean matchPositions(EventTrackerStatus that)
      Match the position fields of this and that. This means getCurrentPosition(), getResetPosition() and mergeCompletedPosition() ()} are taken into account.
      Parameters:
      that - the other EventTrackerStatus to match with
      Returns:
      true if the positions fields of this and that match, otherwise false