Class Position
KafkaStreams.query(StateQueryRequest), a
query result may contain information from multiple store partitions, each of which contains
information from multiple input topics' partitions. This class can be used to summarize all of
that positional information.
This class is threadsafe, although it is mutable. Readers are recommended to use copy() to avoid seeing mutations to the Position after they get the reference. For
examples, when a store executes a StateStore.query(Query, PositionBound, QueryConfig) request and returns its current position via QueryResult.setPosition(Position), it should pass a copy of its position instead of the mutable
reference.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()Create a deep copy of the Position.static PositionCreate a new, empty Position.booleanstatic PositionCreate a new Position and populate it with a mapping of topic -> partition -> offset.getPartitionPositions(String topic) Return the partition -> offset mapping for a specific topic.Return the topics that are represented in this Position.inthashCode()booleanisEmpty()Merges the provided Position into the current instance.toString()withComponent(String topic, int partition, long offset) Augment an existing Position by setting a new offset for a topic and partition.
-
Method Details
-
emptyPosition
Create a new, empty Position. -
fromMap
Create a new Position and populate it with a mapping of topic -> partition -> offset.Note, the resulting Position does not share any structure with the provided map, so subsequent changes to the map or Position will not affect the other.
-
withComponent
Augment an existing Position by setting a new offset for a topic and partition.Note: enforces monotonicity on offsets. I.e., if there is already a component for the same topic and partition with a larger offset, the update will succeed but not overwrite the offset.
Returns a self-reference for chained calls. Note: this method mutates the Position.
-
copy
Create a deep copy of the Position. -
merge
-
getTopics
-
getPartitionPositions
-
toString
-
equals
-
hashCode
-
isEmpty
public boolean isEmpty()
-