Class TrackerStatus
java.lang.Object
org.axonframework.messaging.eventhandling.processing.streaming.segmenting.TrackerStatus
- All Implemented Interfaces:
EventTrackerStatus
Implementation of the
EventTrackerStatus, providing simply modification methods to switch from one
EventTrackerStatus value object to another.- Since:
- 3.0
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionTrackerStatus(Segment segment, boolean caughtUp, TrackingToken trackingToken, Throwable errorState) TrackerStatus(Segment segment, TrackingToken trackingToken) -
Method Summary
Modifier and TypeMethodDescriptionadvancedTo(TrackingToken trackingToken) caughtUp()Returns thisTrackerStatusif it is caught up, otherwise return a new instance with the caught up flag set to true.booleanReturn the estimated relative current token position this Segment represents.getError()Returns the exception that caused processing to fail, if present.Return theTrackingTokenthisEventTrackerStatusportrays the status of.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.inthashCode()booleanWhether the Segment of this status has caught up with the head of the event stream.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.Return the estimated relative token position this Segment will have after a merge operation is complete.split()Splits the current status object to reflect the status of their underlying segments being split.static TrackerStatus[]split(Segment segment, TrackingToken trackingToken) Split the givensegmentandtrackingTokenin two.toString()Return a newTrackerStatusbased on this status, removing theerrorState.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.eventhandling.processing.streaming.segmenting.EventTrackerStatus
isDifferent, isDifferent, matchPositions, matchStates, trackerAdded, trackerRemoved
-
Constructor Details
-
TrackerStatus
- Parameters:
segment- theSegmentthisEventTrackerStatusshares the status oftrackingToken- theTrackingTokenthisEventTrackerStatusshares the status of
-
TrackerStatus
public TrackerStatus(Segment segment, boolean caughtUp, TrackingToken trackingToken, Throwable errorState) Construct aEventTrackerStatusto portray the status of the givensegmentandtrackingToken. ThecaughtUp booleanspecifies whether thetrackingTokenreached the head of the stream at least once. AThrowablecan be provided to signal thisEventTrackerStatusis in an error state- Parameters:
segment- theSegmentthisEventTrackerStatusshares the status ofcaughtUp- abooleanspecifying whether thisEventTrackerStatusreached the head of the stream at least once.trackingToken- theTrackingTokenthisEventTrackerStatusshares the status oferrorState- aThrowabledefining the error status of thisEventTrackerStatus. Ifnull, the status is not in an error state
-
-
Method Details
-
caughtUp
Returns thisTrackerStatusif it is caught up, otherwise return a new instance with the caught up flag set to true.- Returns:
- this
TrackerStatusif it is caught up, otherwise return a new instance with the caught up flag set to true
-
advancedTo
Advance thisTrackerStatus'TrackingTokentowards the giventrackingToken. If this status' token is identical to the given token, returnthis. Otherwise create a newTrackerStatusinstance using the giventrackingToken.- Parameters:
trackingToken- theTrackingTokento advance thisTrackerStatus' token towards, if they are not the same- Returns:
- this
TrackerStatusif the giventrackingTokenis identical to the current one, otherwise a newTrackerStatusinstance with the giventrackingToken
-
markError
- Parameters:
error- theThrowableused to define theerrorState- Returns:
- a new
TrackerStatusbased on this status, setting the givenerroras theerrorState
-
unmarkError
Return a newTrackerStatusbased on this status, removing theerrorState.- Returns:
- a new
TrackerStatusbased on this status, removing theerrorState
-
getInternalTrackingToken
Return theTrackingTokenthisEventTrackerStatusportrays the status of.- Returns:
- the
TrackingTokenthisEventTrackerStatusportrays the status of
-
split
Splits the current status object to reflect the status of their underlying segments being split.- Returns:
- an array with two status objects, representing the status of the split segments
-
split
Split the givensegmentandtrackingTokenin two. Constructs an array containing twoTrackerStatuss objects based on the split.- Parameters:
segment- theSegmentto split in twotrackingToken- theTrackingTokento split in two- Returns:
- an array of two
TrackerStatuss objects based on the split of the givensegmentandtrackingToken
-
getSegment
Description copied from interface:EventTrackerStatusThe segment for which this status is valid.- Specified by:
getSegmentin interfaceEventTrackerStatus- Returns:
- segment for which this status is valid
-
isCaughtUp
public boolean isCaughtUp()Description copied from interface:EventTrackerStatusWhether 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.- Specified by:
isCaughtUpin interfaceEventTrackerStatus- Returns:
- whether the Segment of this status has caught up with the head of the event stream
-
isReplaying
public boolean isReplaying()Description copied from interface:EventTrackerStatusIndicates 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.- Specified by:
isReplayingin interfaceEventTrackerStatus- Returns:
trueif this segment is replaying historic events after areset, otherwisefalse
-
isMerging
public boolean isMerging()Description copied from interface:EventTrackerStatusIndicates whether this Segment is still merging two (or more) Segments. The merging process will be done once all Segments have reached the same position.- Specified by:
isMergingin interfaceEventTrackerStatus- Returns:
trueif this segment is merging Segments, otherwisefalse
-
mergeCompletedPosition
Description copied from interface:EventTrackerStatusReturn the estimated relative token position this Segment will have after a merge operation is complete. Will return a non-empty result as long asEventTrackerStatus.isMerging()} returns true. In case no estimation can be given or no merge in progress, anOptionalLong.empty()will be returned.- Specified by:
mergeCompletedPositionin interfaceEventTrackerStatus- Returns:
- return the estimated relative position this Segment will reach after a merge operation is complete.
-
getTrackingToken
Description copied from interface:EventTrackerStatusThe 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.
- Specified by:
getTrackingTokenin interfaceEventTrackerStatus- Returns:
- tracking token of the last event that has been seen by this Segment
-
isErrorState
public boolean isErrorState()Description copied from interface:EventTrackerStatusIndicates whether this status represents an error. When this method returntrue, theEventTrackerStatus.getError()will return the exception that caused the failure.- Specified by:
isErrorStatein interfaceEventTrackerStatus- Returns:
trueif an error was reported, otherwisefalse
-
getError
Description copied from interface:EventTrackerStatusReturns the exception that caused processing to fail, if present. If the segment is being processed normally, this method returnsnull.- Specified by:
getErrorin interfaceEventTrackerStatus- Returns:
- the exception that caused processing to fail, or
nullwhen processing normally
-
getCurrentPosition
Description copied from interface:EventTrackerStatusReturn 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.- Specified by:
getCurrentPositionin interfaceEventTrackerStatus- Returns:
- return the estimated relative current token position this Segment represents
-
getResetPosition
Description copied from interface:EventTrackerStatusReturn 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.- Specified by:
getResetPositionin interfaceEventTrackerStatus- Returns:
- the relative position at which a reset was triggered for this Segment
-
equals
-
hashCode
public int hashCode() -
toString
-