Class StreamThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class StreamThread
    extends java.lang.Thread
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  StreamThread.ProcessingMode  
      static class  StreamThread.State
      Stream thread states are the possible states that a stream thread can be in.
      static interface  StreamThread.StateListener
      Listen to state change events
      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      StreamThread​(org.apache.kafka.common.utils.Time time, StreamsConfig config, org.apache.kafka.clients.admin.Admin adminClient, org.apache.kafka.clients.consumer.Consumer<byte[],​byte[]> mainConsumer, org.apache.kafka.clients.consumer.Consumer<byte[],​byte[]> restoreConsumer, ChangelogReader changelogReader, java.lang.String originalReset, TaskManager taskManager, StreamsMetricsImpl streamsMetrics, InternalTopologyBuilder builder, java.lang.String threadId, org.apache.kafka.common.utils.LogContext logContext, java.util.concurrent.atomic.AtomicInteger assignmentErrorCode, java.util.concurrent.atomic.AtomicLong nextProbingRebalanceMs)  
    • Constructor Detail

      • StreamThread

        public StreamThread​(org.apache.kafka.common.utils.Time time,
                            StreamsConfig config,
                            org.apache.kafka.clients.admin.Admin adminClient,
                            org.apache.kafka.clients.consumer.Consumer<byte[],​byte[]> mainConsumer,
                            org.apache.kafka.clients.consumer.Consumer<byte[],​byte[]> restoreConsumer,
                            ChangelogReader changelogReader,
                            java.lang.String originalReset,
                            TaskManager taskManager,
                            StreamsMetricsImpl streamsMetrics,
                            InternalTopologyBuilder builder,
                            java.lang.String threadId,
                            org.apache.kafka.common.utils.LogContext logContext,
                            java.util.concurrent.atomic.AtomicInteger assignmentErrorCode,
                            java.util.concurrent.atomic.AtomicLong nextProbingRebalanceMs)
    • Method Detail

      • setStateListener

        public void setStateListener​(StreamThread.StateListener listener)
        Set the StreamThread.StateListener to be notified when state changes. Note this API is internal to Kafka Streams and is not intended to be used by an external application.
      • isRunning

        public boolean isRunning()
      • eosEnabled

        public static boolean eosEnabled​(StreamsConfig config)
      • run

        public void run()
        Execute the stream processors
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
        Throws:
        org.apache.kafka.common.KafkaException - for any Kafka-related exceptions
        java.lang.RuntimeException - for any other non-Kafka exceptions
      • shutdown

        public void shutdown()
        Shutdown this stream thread.

        Note that there is nothing to prevent this function from being called multiple times (e.g., in testing), hence the state is set only the first time

      • activeTaskMap

        public java.util.Map<TaskId,​Task> activeTaskMap()
      • activeTasks

        public java.util.List<Task> activeTasks()
      • allTasks

        public java.util.Map<TaskId,​Task> allTasks()
      • toString

        public java.lang.String toString()
        Produces a string representation containing useful information about a StreamThread. This is useful in debugging scenarios.
        Overrides:
        toString in class java.lang.Thread
        Returns:
        A string representation of the StreamThread instance.
      • toString

        public java.lang.String toString​(java.lang.String indent)
        Produces a string representation containing useful information about a StreamThread, starting with the given indent. This is useful in debugging scenarios.
        Returns:
        A string representation of the StreamThread instance.
      • producerMetrics

        public java.util.Map<org.apache.kafka.common.MetricName,​org.apache.kafka.common.Metric> producerMetrics()
      • consumerMetrics

        public java.util.Map<org.apache.kafka.common.MetricName,​org.apache.kafka.common.Metric> consumerMetrics()
      • adminClientMetrics

        public java.util.Map<org.apache.kafka.common.MetricName,​org.apache.kafka.common.Metric> adminClientMetrics()