public class ReplayToken extends Object implements TrackingToken, WrappedToken, Serializable
Constructor and Description |
---|
ReplayToken(TrackingToken tokenAtReset)
Initialize a ReplayToken, using the given
tokenAtReset to represent the position at which a reset was
triggered. |
ReplayToken(TrackingToken tokenAtReset,
TrackingToken newRedeliveryToken)
Initializes a ReplayToken with
tokenAtReset which represents the position at which a reset was triggered
and the newRedeliveryToken which represents current token. |
Modifier and Type | Method and Description |
---|---|
TrackingToken |
advancedTo(TrackingToken newToken)
Advance this token to the given
newToken . |
boolean |
covers(TrackingToken other)
Indicates whether this token covers the
other token completely. |
static TrackingToken |
createReplayToken(TrackingToken tokenAtReset)
Creates a new TrackingToken that represents the tail position of a stream, in reset state, when appropriate.
|
static TrackingToken |
createReplayToken(TrackingToken tokenAtReset,
TrackingToken startPosition)
Creates a new TrackingToken that represents the given
startPosition of a stream, in reset state,
when appropriate. |
boolean |
equals(Object o) |
TrackingToken |
getCurrentToken()
Gets the current token.
|
TrackingToken |
getTokenAtReset()
Gets the token representing the position at which the reset was triggered.
|
int |
hashCode() |
static boolean |
isReplay(Message<?> message)
Indicates whether the given message is "redelivered", as a result of a previous reset.
|
static boolean |
isReplay(TrackingToken trackingToken)
Indicates whether the given
trackingToken represents a position that is part of a replay. |
TrackingToken |
lowerBound(TrackingToken other)
Returns a token that represents the lower bound between this and the
other token. |
String |
toString() |
TrackingToken |
unwrap()
Returns the token representing the current position in the stream.
|
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. |
public ReplayToken(TrackingToken tokenAtReset)
tokenAtReset
to represent the position at which a reset was
triggered. The current token is reset to the initial position.
Using the createReplayToken(TrackingToken)
is preferred, as it covers cases where a replay is started
tokenAtReset
- The token representing the position at which the reset was triggered.public ReplayToken(TrackingToken tokenAtReset, TrackingToken newRedeliveryToken)
tokenAtReset
which represents the position at which a reset was triggered
and the newRedeliveryToken
which represents current token.tokenAtReset
- The token representing the position at which the reset was triggerednewRedeliveryToken
- The current tokenpublic static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition)
startPosition
of a stream, in reset state,
when appropriate.tokenAtReset
- The token present when the reset was triggeredstartPosition
- The position where the token should be reset topublic static TrackingToken createReplayToken(TrackingToken tokenAtReset)
tokenAtReset
- The token present when the reset was triggeredpublic static boolean isReplay(Message<?> message)
true
, this
means this message has been delivered to this processor before its token was reset.message
- The message to inspecttrue
if the message is a replaypublic static boolean isReplay(TrackingToken trackingToken)
trackingToken
represents a position that is part of a replay.trackingToken
- The token to verifytrue
if the token indicates a replaypublic TrackingToken getTokenAtReset()
public TrackingToken getCurrentToken()
public TrackingToken advancedTo(TrackingToken newToken)
newToken
.newToken
- The token representing the position to advance topublic TrackingToken lowerBound(TrackingToken other)
TrackingToken
other
token. Effectively, the
returned token will cause messages not received by both this and the other
token to be redelivered.lowerBound
in interface TrackingToken
other
- The token to compare to this onepublic TrackingToken upperBound(TrackingToken other)
TrackingToken
other
represents. Effectively, this means this token will only deliver messages that neither this, nor
the other have been received.upperBound
in interface TrackingToken
other
- The token to compare this token topublic boolean covers(TrackingToken other)
TrackingToken
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.covers
in interface TrackingToken
other
- The token to compare to this onetrue
if this token covers the other, otherwise false
public TrackingToken unwrap()
WrappedToken
unwrap
in interface WrappedToken
Copyright © 2010–2018. All rights reserved.