Skip to content

InternalStreamsBuilder

Creating Instance

InternalStreamsBuilder takes the following to be created:

InternalStreamsBuilder is created when:

Root Node

GraphNode root

InternalStreamsBuilder creates a root GraphNode when created.

This root node is used to addGraphNode in the following high-level operators:

This root node is then used to build and optimize a topology (for StreamsBuilder).

globalTable

GlobalKTable<K, V> globalTable(
  String topic,
  ConsumedInternal<K, V> consumed,
  MaterializedInternal<K, V, KeyValueStore<Bytes, byte[]>> materialized)

globalTable requests the given MaterializedInternal to disable logging (withLoggingDisabled).

globalTable requests the given ConsumedInternal for the name and creates a NamedInternal.

globalTable requests the NamedInternal for source and processor names.

globalTable requests the given MaterializedInternal for the queryable store name and creates a KTableSource.

globalTable builds a TableSourceNode and addGraphNode it to the root node.

In the end, globalTable creates a GlobalKTableImpl (with a KTableSourceValueGetterSupplier with the store name and the queryable store name from the given MaterializedInternal).

globalTable is used when:

buildAndOptimizeTopology

void buildAndOptimizeTopology() // (1)
void buildAndOptimizeTopology(
  Properties props)
  1. Used in tests only

buildAndOptimizeTopology...FIXME

buildAndOptimizeTopology is used when:

mergeDuplicateSourceNodes

void mergeDuplicateSourceNodes()

mergeDuplicateSourceNodes...FIXME

maybePerformOptimizations

void maybePerformOptimizations(
  Properties props)

maybePerformOptimizations...FIXME

optimizeKTableSourceTopics

void optimizeKTableSourceTopics()

optimizeKTableSourceTopics...FIXME

maybeOptimizeRepartitionOperations

void maybeOptimizeRepartitionOperations()

maybeOptimizeRepartitionOperations...FIXME

maybeUpdateKeyChangingRepartitionNodeMap

void maybeUpdateKeyChangingRepartitionNodeMap()

maybeUpdateKeyChangingRepartitionNodeMap...FIXME

createRepartitionNode

OptimizableRepartitionNode<K, V> createRepartitionNode(
  String repartitionTopicName,
  Serde<K> keySerde,
  Serde<V> valueSerde)

createRepartitionNode...FIXME

Adding StateStore to Topology

void addStateStore(
  StoreBuilder<?> builder)

addStateStore adds a new StateStoreNode to the root node.

addStateStore is used when:

  • StreamsBuilder is requested to addStateStore
  • KTableImpl is requested to doJoinOnForeignKey

stream

KStream<K, V> stream(
  Collection<String> topics,
  ConsumedInternal<K, V> consumed)
KStream<K, V> stream(
  Pattern topicPattern,
  ConsumedInternal<K, V> consumed)

stream...FIXME

stream is used when:

  • StreamsBuilder is requested to stream

Adding GraphNode

void addGraphNode(
  Collection<GraphNode> parents,
  GraphNode child)

addGraphNode adds the given child GraphNode to the children of the given parent GraphNodes.

In the end, addGraphNode maybeAddNodeForOptimizationMetadata (with the child node).

maybeAddNodeForOptimizationMetadata

void maybeAddNodeForOptimizationMetadata(
  GraphNode node)

maybeAddNodeForOptimizationMetadata setBuildPriority of the given GraphNode to the current buildPriorityIndex (and increments it).

maybeAddNodeForOptimizationMetadata adds the given GraphNode to the following internal registries:

Merge GraphNodes

InternalStreamsBuilder defines mergeNodes internal registry of GraphNodes that are merge nodes (that are found in maybeAddNodeForOptimizationMetadata while adding a new GraphNode).

mergeNodes is used for maybeUpdateKeyChangingRepartitionNodeMap.

Back to top