Class Position
java.lang.Object
io.fluxzero.common.api.tracking.Position
Represents the tracking state of a consumer, i.e. the last known indexes of consumed messages per segment.
Fluxzero segments the message log to support parallel consumption. A Position stores
the most recent message index processed for each segment. This allows precise resumption of message
consumption on restarts or rebalances.
A Position is an immutable structure and may be merged or queried to support multi-segment tracking.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetIndex(int segment) booleanisNew(int[] segment) booleanisNewIndex(int segment, Long messageIndex) booleanisNewMessage(SerializedMessage message) lowestIndexForSegment(int[] segment) Merges twoPositionobjects by taking the highest known index per segment.static PositionCreates an empty position.Splits the position map into contiguous segment ranges that share the same index.
-
Field Details
-
MAX_SEGMENT
public static int MAX_SEGMENT -
FULL_SEGMENT
public static int[] FULL_SEGMENT
-
-
Constructor Details
-
Position
public Position(long index) -
Position
public Position(int[] segment, long index)
-
-
Method Details
-
newPosition
Creates an empty position. -
getIndex
-
isNew
public boolean isNew(int[] segment) -
lowestIndexForSegment
-
merge
-
splitInSegments
-
isNewMessage
-
isNewIndex
-