Class StateQueryRequest<R>

Type Parameters:
R - The type of the query result.

@Evolving public class StateQueryRequest<R> extends Object
The request object for Interactive Queries. This is an immutable builder class for passing all required and optional arguments for querying a state store in Kafka Streams.

  • Method Details

    • inStore

      public static StateQueryRequest.InStore inStore(String name)
      Specifies the name of the store to query.
    • withPositionBound

      public StateQueryRequest<R> withPositionBound(PositionBound positionBound)
      Bounds the position of the state store against its input topics.
    • withAllPartitions

      public StateQueryRequest<R> withAllPartitions()
      Specifies that the query will run against all locally available partitions.
    • withPartitions

      public StateQueryRequest<R> withPartitions(Set<Integer> partitions)
      Specifies a set of partitions to run against. If some partitions are not locally available, the response will contain a FailureReason.NOT_PRESENT for those partitions. If some partitions in this set are not valid partitions for the store, the response will contain a FailureReason.DOES_NOT_EXIST for those partitions.
    • enableExecutionInfo

      public StateQueryRequest<R> enableExecutionInfo()
      Requests for stores and the Streams runtime to record any useful details about how the query was executed.
    • requireActive

      public StateQueryRequest<R> requireActive()
      Specifies that this query should only run on partitions for which this instance is the leader (aka "active"). Partitions for which this instance is not the active replica will return FailureReason.NOT_ACTIVE.
    • getStoreName

      public String getStoreName()
      The name of the store this request is for.
    • getPositionBound

      public PositionBound getPositionBound()
      The bound that this request places on its query, in terms of the partitions' positions against its inputs.
    • getQuery

      public Query<R> getQuery()
      The query this request is meant to run.
    • isAllPartitions

      public boolean isAllPartitions()
      Whether this request should fetch from all locally available partitions.
    • getPartitions

      public Set<Integer> getPartitions()
      If the request is for specific partitions, return the set of partitions to query.
      IllegalStateException - if this is a request for all partitions
    • executionInfoEnabled

      public boolean executionInfoEnabled()
      Whether the request includes detailed execution information.
    • isRequireActive

      public boolean isRequireActive()
      Whether this request requires the query to execute only on active partitions.