Interface KafkaStreamsState


public interface KafkaStreamsState
A read-only metadata class representing the current state of each KafkaStreams client with at least one StreamThread participating in this rebalance
  • Method Details

    • processId

      ProcessId processId()
      Returns:
      the processId of the application instance running on this KafkaStreams client
    • numProcessingThreads

      int numProcessingThreads()
      Returns the number of processing threads available to work on tasks for this KafkaStreams client, which represents its overall capacity for work relative to other KafkaStreams clients.
      Returns:
      the number of processing threads on this KafkaStreams client
    • consumerClientIds

      SortedSet<String> consumerClientIds()
      Returns:
      the set of consumer client ids for this KafkaStreams client
    • previousActiveTasks

      SortedSet<TaskId> previousActiveTasks()
      Returns:
      the set of all active tasks owned by consumers on this KafkaStreams client since the previous rebalance
    • previousStandbyTasks

      SortedSet<TaskId> previousStandbyTasks()
      Returns:
      the set of all standby tasks owned by consumers on this KafkaStreams client since the previous rebalance
    • lagFor

      long lagFor(TaskId task)
      Returns the total lag across all logged stores in the task. Equal to the end offset sum if this client did not have any state for this task on disk.
      Returns:
      end offset sum - offset sum Task.LATEST_OFFSET if this was previously an active running task on this client
      Throws:
      UnsupportedOperationException - if the user did not request task lags be computed.
    • prevTasksByLag

      SortedSet<TaskId> prevTasksByLag(String consumerClientId)
      Returns:
      the previous tasks assigned to this consumer ordered by lag, filtered for any tasks that don't exist in this assignment
      Throws:
      UnsupportedOperationException - if the user did not request task lags be computed.
    • statefulTasksToLagSums

      Map<TaskId,Long> statefulTasksToLagSums()
      Returns a collection containing all (and only) stateful tasks in the topology by TaskId, mapped to its "offset lag sum". This is computed as the difference between the changelog end offset and the current offset, summed across all logged state stores in the task.
      Returns:
      a map from all stateful tasks to their lag sum
      Throws:
      UnsupportedOperationException - if the user did not request task lags be computed.
    • hostInfo

      Optional<HostInfo> hostInfo()
      The HostInfo of this KafkaStreams client, if set via the application.server config
      Returns:
      the host info for this KafkaStreams client if configured, else Optional.empty()
    • clientTags

      Map<String,String> clientTags()
      The client tags for this KafkaStreams client, if set any have been via configs using the StreamsConfig.clientTagPrefix(java.lang.String)

      Can be used however you want, or passed in to enable the rack-aware standby task assignor.

      Returns:
      all the client tags found in this KafkaStreams client's StreamsConfig
    • rackId

      Optional<String> rackId()
      Returns:
      the rackId for this KafkaStreams client, or Optional.empty() if none was configured