public interface TrackingToken
| Modifier and Type | Method and Description |
|---|---|
boolean |
covers(TrackingToken other)
Indicates whether this token covers the
other token completely. |
TrackingToken |
lowerBound(TrackingToken other)
Returns a token that represents the lower bound between this and the
other token. |
default OptionalLong |
position()
Return the estimated relative position this token represents.
|
default boolean |
samePositionAs(TrackingToken other)
Indicates whether
this token is at the exact same spot in the event stream as the other token. |
TrackingToken |
upperBound(TrackingToken other)
Returns the token that represents the furthest possible position in a stream that either this token or the given
other represents. |
TrackingToken lowerBound(TrackingToken other)
other token. Effectively, the
returned token will cause messages not received by both this and the other token to be redelivered.other - The token to compare to this oneTrackingToken upperBound(TrackingToken other)
other represents. Effectively, this means this token will only deliver messages that neither this, nor
the other have been received.other - The token to compare this token toboolean covers(TrackingToken other)
other token completely. That means that this token represents a
position in a stream that has received all of the messages that a stream represented by the other token
has received.
Note that this operation is only safe when comparing tokens obtained from messages from the same
StreamableMessageSource.
other - The token to compare to this onetrue if this token covers the other, otherwise falsedefault OptionalLong position()
OptionalLong.empty() will be returned.default boolean samePositionAs(TrackingToken other)
this token is at the exact same spot in the event stream as the other token.
This method is particularly useful when comparing tokens from different points in time, such as during replay detection, where token implementations may naturally differ.
By default, this method checks bidirectional coverage: this.covers(other) && other.covers(this),
which ensures both tokens are at the same position.
other - The token to validate against this token.true if this token is at the same location as the other token, otherwise false.
Returns false if other is null.covers(TrackingToken)Copyright © 2010–2026. All rights reserved.