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 Summary
Modifier and TypeMethodDescriptionThe client tags for this KafkaStreams client, if set any have been via configs using theStreamsConfig.clientTagPrefix(java.lang.String)
hostInfo()
TheHostInfo
of this KafkaStreams client, if set via theapplication.server
configlong
Returns the total lag across all logged stores in the task.int
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.prevTasksByLag
(String consumerClientId) rackId()
Returns a collection containing all (and only) stateful tasks in the topology byTaskId
, mapped to its "offset lag sum".
-
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
- Returns:
- the set of consumer client ids for this KafkaStreams client
-
previousActiveTasks
- Returns:
- the set of all active tasks owned by consumers on this KafkaStreams client since the previous rebalance
-
previousStandbyTasks
- Returns:
- the set of all standby tasks owned by consumers on this KafkaStreams client since the previous rebalance
-
lagFor
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
- 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
Returns a collection containing all (and only) stateful tasks in the topology byTaskId
, 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
TheHostInfo
of this KafkaStreams client, if set via theapplication.server
config- Returns:
- the host info for this KafkaStreams client if configured, else
Optional.empty()
-
clientTags
The client tags for this KafkaStreams client, if set any have been via configs using theStreamsConfig.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
- Returns:
- the rackId for this KafkaStreams client, or
Optional.empty()
if none was configured
-