Package org.apache.kafka.streams.query
Class StateQueryResult<R>
java.lang.Object
org.apache.kafka.streams.query.StateQueryResult<R>
- Type Parameters:
R
- The type of the query result.
The response object for interactive queries. This wraps the individual partition results, as well
as metadata relating to the result as a whole.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addResult
(int partition, QueryResult<R> r) Set the result for a partitioned store query.The query's result for global store queries.For queries that are expected to match records in only one partition, returns the result.The query's result for each partition that executed the query.The position of the state store at the moment it executed the query.void
Set the result for a global store query.toString()
-
Constructor Details
-
StateQueryResult
public StateQueryResult()
-
-
Method Details
-
setGlobalResult
Set the result for a global store query. Used by Kafka Streams and available for tests. -
addResult
Set the result for a partitioned store query. Used by Kafka Streams and available for tests. -
getPartitionResults
The query's result for each partition that executed the query. Empty for global store queries. -
getOnlyPartitionResult
For queries that are expected to match records in only one partition, returns the result.- Throws:
IllegalArgumentException
- if the results are not for exactly one partition.
-
getGlobalResult
The query's result for global store queries. Isnull
for non-global (partitioned) store queries. -
getPosition
The position of the state store at the moment it executed the query. In conjunction withStateQueryRequest.withPositionBound(org.apache.kafka.streams.query.PositionBound)
, this can be used to achieve a good balance between consistency and availability in which repeated queries are guaranteed to advance in time while allowing reads to be served from any replica that is caught up to that caller's prior observations. -
toString
-