Class StateQueryResult<R>

java.lang.Object
org.apache.kafka.streams.query.StateQueryResult<R>
Type Parameters:
R - The type of the query result.

@Evolving public class StateQueryResult<R> extends Object
The response object for interactive queries. This wraps the individual partition results, as well as metadata relating to the result as a whole.

  • Constructor Details Link icon

    • StateQueryResult Link icon

      public StateQueryResult()
  • Method Details Link icon

    • setGlobalResult Link icon

      public void setGlobalResult(QueryResult<R> r)
      Set the result for a global store query. Used by Kafka Streams and available for tests.
    • addResult Link icon

      public void addResult(int partition, QueryResult<R> r)
      Set the result for a partitioned store query. Used by Kafka Streams and available for tests.
    • getPartitionResults Link icon

      public Map<Integer,QueryResult<R>> getPartitionResults()
      The query's result for each partition that executed the query. Empty for global store queries.
    • getOnlyPartitionResult Link icon

      public QueryResult<R> 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 Link icon

      public QueryResult<R> getGlobalResult()
      The query's result for global store queries. Is null for non-global (partitioned) store queries.
    • getPosition Link icon

      public Position getPosition()
      The position of the state store at the moment it executed the query. In conjunction with StateQueryRequest.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 Link icon

      public String toString()
      Overrides:
      toString in class Object