Class TopologyBuilder

  • Direct Known Subclasses:
    KStreamBuilder

    @Deprecated
    public class TopologyBuilder
    extends java.lang.Object
    Deprecated.
    use Topology instead
    A component that is used to build a ProcessorTopology. A topology contains an acyclic graph of sources, processors, and sinks. A source is a node in the graph that consumes one or more Kafka topics and forwards them to its child nodes. A processor is a node in the graph that receives input records from upstream nodes, processes that records, and optionally forwarding new records to one or all of its children. Finally, a sink is a node in the graph that receives records from upstream nodes and writes them to a Kafka topic. This builder allows you to construct an acyclic graph of these nodes, and the builder is then passed into a new KafkaStreams instance that will then begin consuming, processing, and producing records.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TopologyBuilder.AutoOffsetReset
      Deprecated.
      Enum used to define auto offset reset policy when creating KStream or KTable.
      static class  TopologyBuilder.TopicsInfo
      Deprecated.
      NOTE this class would not needed by developers working with the processor APIs, but only used for internal functionalities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      org.apache.kafka.streams.processor.internals.InternalTopologyBuilder internalTopologyBuilder
      Deprecated.
      NOTE this member would not needed by developers working with the processor APIs, but only used for internal functionalities.
    • Constructor Summary

      Constructors 
      Constructor Description
      TopologyBuilder()
      Deprecated.
      Create a new builder.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      TopologyBuilder addGlobalStore​(StateStoreSupplier<KeyValueStore> storeSupplier, java.lang.String sourceName, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valueDeserializer, java.lang.String topic, java.lang.String processorName, ProcessorSupplier stateUpdateSupplier)
      Deprecated.
      Adds a global StateStore to the topology.
      TopologyBuilder addGlobalStore​(StateStoreSupplier<KeyValueStore> storeSupplier, java.lang.String sourceName, TimestampExtractor timestampExtractor, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valueDeserializer, java.lang.String topic, java.lang.String processorName, ProcessorSupplier stateUpdateSupplier)
      Deprecated.
      Adds a global StateStore to the topology.
      TopologyBuilder addInternalTopic​(java.lang.String topicName)
      Deprecated.
      Adds an internal topic NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      TopologyBuilder addProcessor​(java.lang.String name, ProcessorSupplier supplier, java.lang.String... predecessorNames)
      Deprecated.
      Add a new processor node that receives and processes records output by one or more predecessor source or processor node.
      TopologyBuilder addSink​(java.lang.String name, java.lang.String topic, java.lang.String... predecessorNames)
      Deprecated.
      Add a new sink that forwards records from predecessor nodes (processors and/or sources) to the named Kafka topic.
      <K,​V>
      TopologyBuilder
      addSink​(java.lang.String name, java.lang.String topic, org.apache.kafka.common.serialization.Serializer<K> keySerializer, org.apache.kafka.common.serialization.Serializer<V> valSerializer, StreamPartitioner<? super K,​? super V> partitioner, java.lang.String... predecessorNames)
      Deprecated.
      Add a new sink that forwards records from predecessor nodes (processors and/or sources) to the named Kafka topic.
      TopologyBuilder addSink​(java.lang.String name, java.lang.String topic, org.apache.kafka.common.serialization.Serializer keySerializer, org.apache.kafka.common.serialization.Serializer valSerializer, java.lang.String... predecessorNames)
      Deprecated.
      Add a new sink that forwards records from predecessor nodes (processors and/or sources) to the named Kafka topic.
      TopologyBuilder addSink​(java.lang.String name, java.lang.String topic, StreamPartitioner partitioner, java.lang.String... predecessorNames)
      Deprecated.
      Add a new sink that forwards records from predecessor nodes (processors and/or sources) to the named Kafka topic, using the supplied partitioner.
      TopologyBuilder addSource​(java.lang.String name, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(java.lang.String name, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(java.lang.String name, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valDeserializer, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forwards the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(java.lang.String name, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valDeserializer, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TimestampExtractor timestampExtractor, java.lang.String name, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TimestampExtractor timestampExtractor, java.lang.String name, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, java.lang.String name, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, java.lang.String name, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, java.lang.String name, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valDeserializer, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, java.lang.String name, TimestampExtractor timestampExtractor, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valDeserializer, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forwards the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, java.lang.String name, TimestampExtractor timestampExtractor, org.apache.kafka.common.serialization.Deserializer keyDeserializer, org.apache.kafka.common.serialization.Deserializer valDeserializer, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, TimestampExtractor timestampExtractor, java.lang.String name, java.lang.String... topics)
      Deprecated.
      Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes.
      TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset, TimestampExtractor timestampExtractor, java.lang.String name, java.util.regex.Pattern topicPattern)
      Deprecated.
      Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes.
      TopologyBuilder addStateStore​(StateStoreSupplier supplier, java.lang.String... processorNames)
      Deprecated.
      Adds a state store
      org.apache.kafka.streams.processor.internals.ProcessorTopology build​(java.lang.Integer topicGroupId)
      Deprecated.
      Build the topology for the specified topic group.
      org.apache.kafka.streams.processor.internals.ProcessorTopology buildGlobalStateTopology()
      Deprecated.
      Builds the topology for any global state stores NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      TopologyBuilder connectProcessorAndStateStores​(java.lang.String processorName, java.lang.String... stateStoreNames)
      Deprecated.
      Connects the processor and the state stores
      TopologyBuilder connectProcessors​(java.lang.String... processorNames)
      Deprecated.
      Connects a list of processors.
      protected TopologyBuilder connectSourceStoreAndTopic​(java.lang.String sourceStoreName, java.lang.String topic)
      Deprecated.
      This is used only for KStreamBuilder: when adding a KTable from a source topic, we need to add the topic as the KTable's materialized state store's changelog.
      java.util.Collection<java.util.Set<java.lang.String>> copartitionGroups()
      Deprecated.
      Returns the copartition groups.
      TopologyBuilder copartitionSources​(java.util.Collection<java.lang.String> sourceNodes)
      Deprecated.
      Asserts that the streams of the specified source nodes must be copartitioned.
      java.util.regex.Pattern earliestResetTopicsPattern()
      Deprecated.
      Get the Pattern to match all topics requiring to start reading from earliest available offset NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      java.util.Map<java.lang.String,​StateStore> globalStateStores()
      Deprecated.
      Get any global StateStores that are part of the topology NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      java.util.regex.Pattern latestResetTopicsPattern()
      Deprecated.
      Get the Pattern to match all topics requiring to start reading from latest available offset NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> nodeGroups()
      Deprecated.
      Returns the map of node groups keyed by the topic group id.
      TopologyBuilder setApplicationIdAndInternalStream​(java.lang.String applicationId, java.lang.String internalStream, java.lang.String internalStreamCompacted)
      Deprecated.
      This class is not part of public API and should never be used by a developer.
      java.util.regex.Pattern sourceTopicPattern()
      Deprecated.
      NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> stateStoreNameToSourceTopics()
      Deprecated.
      NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      org.apache.kafka.streams.processor.internals.StreamPartitionAssignor.SubscriptionUpdates subscriptionUpdates()
      Deprecated.
      NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      java.util.Map<java.lang.Integer,​TopologyBuilder.TopicsInfo> topicGroups()
      Deprecated.
      Returns the map of topic groups keyed by the group id.
      void updateSubscriptions​(org.apache.kafka.streams.processor.internals.StreamPartitionAssignor.SubscriptionUpdates subscriptionUpdates, java.lang.String threadId)
      Deprecated.
      NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • internalTopologyBuilder

        public final org.apache.kafka.streams.processor.internals.InternalTopologyBuilder internalTopologyBuilder
        Deprecated.
        NOTE this member would not needed by developers working with the processor APIs, but only used for internal functionalities.
    • Constructor Detail

      • TopologyBuilder

        public TopologyBuilder()
        Deprecated.
        Create a new builder.
    • Method Detail

      • setApplicationIdAndInternalStream

        public final TopologyBuilder setApplicationIdAndInternalStream​(java.lang.String applicationId,
                                                                       java.lang.String internalStream,
                                                                       java.lang.String internalStreamCompacted)
        Deprecated.
        This class is not part of public API and should never be used by a developer.
      • addSource

        public final TopologyBuilder addSource​(java.lang.String name,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration. The default TimestampExtractor as specified in the config is used.
        Parameters:
        name - the unique name of the source used to reference this node when adding processor children.
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               java.lang.String name,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration. The default TimestampExtractor as specified in the config is used.
        Parameters:
        offsetReset - the auto offset reset policy to use for this source if no committed offsets found; acceptable values earliest or latest
        name - the unique name of the source used to reference this node when adding processor children.
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TimestampExtractor timestampExtractor,
                                               java.lang.String name,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration.
        Parameters:
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        name - the unique name of the source used to reference this node when adding processor children.
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               TimestampExtractor timestampExtractor,
                                               java.lang.String name,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration.
        Parameters:
        offsetReset - the auto offset reset policy to use for this source if no committed offsets found; acceptable values earliest or latest
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        name - the unique name of the source used to reference this node when adding processor children.
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(java.lang.String name,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration. The default TimestampExtractor as specified in the config is used.
        Parameters:
        name - the unique name of the source used to reference this node when adding processor children.
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               java.lang.String name,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration. The default TimestampExtractor as specified in the config is used.
        Parameters:
        offsetReset - the auto offset reset policy value for this source if no committed offsets found; acceptable values earliest or latest.
        name - the unique name of the source used to reference this node when adding processor children.
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TimestampExtractor timestampExtractor,
                                               java.lang.String name,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration.
        Parameters:
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        name - the unique name of the source used to reference this node when adding processor children.
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               TimestampExtractor timestampExtractor,
                                               java.lang.String name,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forward the records to child processor and/or sink nodes. The source will use the default key deserializer and default value deserializer specified in the stream configuration.
        Parameters:
        offsetReset - the auto offset reset policy value for this source if no committed offsets found; acceptable values earliest or latest.
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        name - the unique name of the source used to reference this node when adding processor children.
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(java.lang.String name,
                                               org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                               org.apache.kafka.common.serialization.Deserializer valDeserializer,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forwards the records to child processor and/or sink nodes. The source will use the specified key and value deserializers. The default TimestampExtractor as specified in the config is used.
        Parameters:
        name - the unique name of the source used to reference this node when adding processor children
        keyDeserializer - key deserializer used to read this source, if not specified the default key deserializer defined in the configs will be used
        valDeserializer - value deserializer used to read this source, if not specified the default value deserializer defined in the configs will be used
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if processor is already added or if topics have already been registered by another source
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               java.lang.String name,
                                               TimestampExtractor timestampExtractor,
                                               org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                               org.apache.kafka.common.serialization.Deserializer valDeserializer,
                                               java.lang.String... topics)
        Deprecated.
        Add a new source that consumes the named topics and forwards the records to child processor and/or sink nodes. The source will use the specified key and value deserializers.
        Parameters:
        offsetReset - the auto offset reset policy to use for this stream if no committed offsets found; acceptable values are earliest or latest.
        name - the unique name of the source used to reference this node when adding processor children.
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        keyDeserializer - key deserializer used to read this source, if not specified the default key deserializer defined in the configs will be used
        valDeserializer - value deserializer used to read this source, if not specified the default value deserializer defined in the configs will be used
        topics - the name of one or more Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if processor is already added or if topics have already been registered by another source
      • addGlobalStore

        public TopologyBuilder addGlobalStore​(StateStoreSupplier<KeyValueStore> storeSupplier,
                                              java.lang.String sourceName,
                                              org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                              org.apache.kafka.common.serialization.Deserializer valueDeserializer,
                                              java.lang.String topic,
                                              java.lang.String processorName,
                                              ProcessorSupplier stateUpdateSupplier)
        Deprecated.
        Adds a global StateStore to the topology. The StateStore sources its data from all partitions of the provided input topic. There will be exactly one instance of this StateStore per Kafka Streams instance.

        A SourceNode with the provided sourceName will be added to consume the data arriving from the partitions of the input topic.

        The provided ProcessorSupplier will be used to create an ProcessorNode that will receive all records forwarded from the SourceNode. This ProcessorNode should be used to keep the StateStore up-to-date. The default TimestampExtractor as specified in the config is used.

        Parameters:
        storeSupplier - user defined state store supplier
        sourceName - name of the SourceNode that will be automatically added
        keyDeserializer - the Deserializer to deserialize keys with
        valueDeserializer - the Deserializer to deserialize values with
        topic - the topic to source the data from
        processorName - the name of the ProcessorSupplier
        stateUpdateSupplier - the instance of ProcessorSupplier
        Returns:
        this builder instance so methods can be chained together; never null
      • addGlobalStore

        public TopologyBuilder addGlobalStore​(StateStoreSupplier<KeyValueStore> storeSupplier,
                                              java.lang.String sourceName,
                                              TimestampExtractor timestampExtractor,
                                              org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                              org.apache.kafka.common.serialization.Deserializer valueDeserializer,
                                              java.lang.String topic,
                                              java.lang.String processorName,
                                              ProcessorSupplier stateUpdateSupplier)
        Deprecated.
        Adds a global StateStore to the topology. The StateStore sources its data from all partitions of the provided input topic. There will be exactly one instance of this StateStore per Kafka Streams instance.

        A SourceNode with the provided sourceName will be added to consume the data arriving from the partitions of the input topic.

        The provided ProcessorSupplier will be used to create an ProcessorNode that will receive all records forwarded from the SourceNode. This ProcessorNode should be used to keep the StateStore up-to-date.

        Parameters:
        storeSupplier - user defined state store supplier
        sourceName - name of the SourceNode that will be automatically added
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        keyDeserializer - the Deserializer to deserialize keys with
        valueDeserializer - the Deserializer to deserialize values with
        topic - the topic to source the data from
        processorName - the name of the ProcessorSupplier
        stateUpdateSupplier - the instance of ProcessorSupplier
        Returns:
        this builder instance so methods can be chained together; never null
      • addSource

        public final TopologyBuilder addSource​(java.lang.String name,
                                               org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                               org.apache.kafka.common.serialization.Deserializer valDeserializer,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes. The source will use the specified key and value deserializers. The provided de-/serializers will be used for all matched topics, so care should be taken to specify patterns for topics that share the same key-value data format. The default TimestampExtractor as specified in the config is used.
        Parameters:
        name - the unique name of the source used to reference this node when adding processor children
        keyDeserializer - key deserializer used to read this source, if not specified the default key deserializer defined in the configs will be used
        valDeserializer - value deserializer used to read this source, if not specified the default value deserializer defined in the configs will be used
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if processor is already added or if topics have already been registered by name
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               java.lang.String name,
                                               TimestampExtractor timestampExtractor,
                                               org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                               org.apache.kafka.common.serialization.Deserializer valDeserializer,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes. The source will use the specified key and value deserializers. The provided de-/serializers will be used for all matched topics, so care should be taken to specify patterns for topics that share the same key-value data format.
        Parameters:
        offsetReset - the auto offset reset policy to use for this stream if no committed offsets found; acceptable values are earliest or latest
        name - the unique name of the source used to reference this node when adding processor children.
        timestampExtractor - the stateless timestamp extractor used for this source, if not specified the default extractor defined in the configs will be used
        keyDeserializer - key deserializer used to read this source, if not specified the default key deserializer defined in the configs will be used
        valDeserializer - value deserializer used to read this source, if not specified the default value deserializer defined in the configs will be used
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if processor is already added or if topics have already been registered by name
      • addSource

        public final TopologyBuilder addSource​(TopologyBuilder.AutoOffsetReset offsetReset,
                                               java.lang.String name,
                                               org.apache.kafka.common.serialization.Deserializer keyDeserializer,
                                               org.apache.kafka.common.serialization.Deserializer valDeserializer,
                                               java.util.regex.Pattern topicPattern)
        Deprecated.
        Add a new source that consumes from topics matching the given pattern and forwards the records to child processor and/or sink nodes. The source will use the specified key and value deserializers. The provided de-/serializers will be used for all matched topics, so care should be taken to specify patterns for topics that share the same key-value data format.
        Parameters:
        offsetReset - the auto offset reset policy to use for this stream if no committed offsets found; acceptable values are earliest or latest
        name - the unique name of the source used to reference this node when adding processor children
        keyDeserializer - key deserializer used to read this source, if not specified the default key deserializer defined in the configs will be used
        valDeserializer - value deserializer used to read this source, if not specified the default value deserializer defined in the configs will be used
        topicPattern - regular expression pattern to match Kafka topics that this source is to consume
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if processor is already added or if topics have already been registered by name
      • addSink

        public final <K,​V> TopologyBuilder addSink​(java.lang.String name,
                                                         java.lang.String topic,
                                                         org.apache.kafka.common.serialization.Serializer<K> keySerializer,
                                                         org.apache.kafka.common.serialization.Serializer<V> valSerializer,
                                                         StreamPartitioner<? super K,​? super V> partitioner,
                                                         java.lang.String... predecessorNames)
        Deprecated.
        Add a new sink that forwards records from predecessor nodes (processors and/or sources) to the named Kafka topic. The sink will use the specified key and value serializers, and the supplied partitioner.
        Parameters:
        name - the unique name of the sink
        topic - the name of the Kafka topic to which this sink should write its records
        keySerializer - the key serializer used when consuming records; may be null if the sink should use the default key serializer specified in the stream configuration
        valSerializer - the value serializer used when consuming records; may be null if the sink should use the default value serializer specified in the stream configuration
        partitioner - the function that should be used to determine the partition for each record processed by the sink
        predecessorNames - the name of one or more source or processor nodes whose output records this sink should consume and write to its topic
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if predecessor is not added yet, or if this processor's name is equal to the predecessor's name
        See Also:
        addSink(String, String, String...), addSink(String, String, StreamPartitioner, String...), addSink(String, String, Serializer, Serializer, String...)
      • addProcessor

        public final TopologyBuilder addProcessor​(java.lang.String name,
                                                  ProcessorSupplier supplier,
                                                  java.lang.String... predecessorNames)
        Deprecated.
        Add a new processor node that receives and processes records output by one or more predecessor source or processor node. Any new record output by this processor will be forwarded to its child processor or sink nodes.
        Parameters:
        name - the unique name of the processor node
        supplier - the supplier used to obtain this node's Processor instance
        predecessorNames - the name of one or more source or processor nodes whose output records this processor should receive and process
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if predecessor is not added yet, or if this processor's name is equal to the predecessor's name
      • addStateStore

        public final TopologyBuilder addStateStore​(StateStoreSupplier supplier,
                                                   java.lang.String... processorNames)
        Deprecated.
        Adds a state store
        Parameters:
        supplier - the supplier used to obtain this state store StateStore instance
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if state store supplier is already added
      • connectProcessorAndStateStores

        public final TopologyBuilder connectProcessorAndStateStores​(java.lang.String processorName,
                                                                    java.lang.String... stateStoreNames)
        Deprecated.
        Connects the processor and the state stores
        Parameters:
        processorName - the name of the processor
        stateStoreNames - the names of state stores that the processor uses
        Returns:
        this builder instance so methods can be chained together; never null
      • connectSourceStoreAndTopic

        protected final TopologyBuilder connectSourceStoreAndTopic​(java.lang.String sourceStoreName,
                                                                   java.lang.String topic)
        Deprecated.
        This is used only for KStreamBuilder: when adding a KTable from a source topic, we need to add the topic as the KTable's materialized state store's changelog. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      • connectProcessors

        public final TopologyBuilder connectProcessors​(java.lang.String... processorNames)
        Deprecated.
        Connects a list of processors. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Parameters:
        processorNames - the name of the processors
        Returns:
        this builder instance so methods can be chained together; never null
        Throws:
        TopologyBuilderException - if less than two processors are specified, or if one of the processors is not added yet
      • addInternalTopic

        public final TopologyBuilder addInternalTopic​(java.lang.String topicName)
        Deprecated.
        Adds an internal topic NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Parameters:
        topicName - the name of the topic
        Returns:
        this builder instance so methods can be chained together; never null
      • copartitionSources

        public final TopologyBuilder copartitionSources​(java.util.Collection<java.lang.String> sourceNodes)
        Deprecated.
        Asserts that the streams of the specified source nodes must be copartitioned. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Parameters:
        sourceNodes - a set of source node names
        Returns:
        this builder instance so methods can be chained together; never null
      • nodeGroups

        public java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> nodeGroups()
        Deprecated.
        Returns the map of node groups keyed by the topic group id. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        groups of node names
      • buildGlobalStateTopology

        public org.apache.kafka.streams.processor.internals.ProcessorTopology buildGlobalStateTopology()
        Deprecated.
        Builds the topology for any global state stores NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        ProcessorTopology
      • globalStateStores

        public java.util.Map<java.lang.String,​StateStore> globalStateStores()
        Deprecated.
        Get any global StateStores that are part of the topology NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        map containing all global StateStores
      • topicGroups

        public java.util.Map<java.lang.Integer,​TopologyBuilder.TopicsInfo> topicGroups()
        Deprecated.
        Returns the map of topic groups keyed by the group id. A topic group is a group of topics in the same task. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        groups of topic names
      • earliestResetTopicsPattern

        public java.util.regex.Pattern earliestResetTopicsPattern()
        Deprecated.
        Get the Pattern to match all topics requiring to start reading from earliest available offset NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        the Pattern for matching all topics reading from earliest offset, never null
      • latestResetTopicsPattern

        public java.util.regex.Pattern latestResetTopicsPattern()
        Deprecated.
        Get the Pattern to match all topics requiring to start reading from latest available offset NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        the Pattern for matching all topics reading from latest offset, never null
      • stateStoreNameToSourceTopics

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> stateStoreNameToSourceTopics()
        Deprecated.
        NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        a mapping from state store name to a Set of source Topics.
      • copartitionGroups

        public java.util.Collection<java.util.Set<java.lang.String>> copartitionGroups()
        Deprecated.
        Returns the copartition groups. A copartition group is a group of source topics that are required to be copartitioned. NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
        Returns:
        groups of topic names
      • subscriptionUpdates

        public org.apache.kafka.streams.processor.internals.StreamPartitionAssignor.SubscriptionUpdates subscriptionUpdates()
        Deprecated.
        NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      • sourceTopicPattern

        public java.util.regex.Pattern sourceTopicPattern()
        Deprecated.
        NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.
      • updateSubscriptions

        public void updateSubscriptions​(org.apache.kafka.streams.processor.internals.StreamPartitionAssignor.SubscriptionUpdates subscriptionUpdates,
                                        java.lang.String threadId)
        Deprecated.
        NOTE this function would not needed by developers working with the processor APIs, but only used for the high-level DSL parsing functionalities.