GraphNode¶
GraphNode
is an abstraction of graph nodes (for InternalStreamsBuilder to build a topology for StreamsBuilder).
Contract¶
writeToTopology¶
void writeToTopology(
InternalTopologyBuilder topologyBuilder,
Properties props)
Used when:
InternalStreamsBuilder
is requested to build and optimize a topology
Implementations¶
- BaseJoinProcessorNode
- BaseRepartitionNode
- ProcessorGraphNode
- SourceGraphNode
- StateStoreNode
- StreamSinkNode
- StreamTableJoinNode
- StreamToTableNode
- TableProcessorNode
Creating Instance¶
GraphNode
takes the following to be created:
- Node Name
Abstract Class
GraphNode
is an abstract class and cannot be created directly. It is created indirectly for the concrete GraphNodes.
mergeNode¶
isMergeNode¶
boolean isMergeNode()
isMergeNode
returns the mergeNode flag.
isMergeNode
is used when:
InternalStreamsBuilder
is requested to maybeAddNodeForOptimizationMetadata
setMergeNode¶
void setMergeNode(
boolean mergeNode)
setMergeNode
sets the mergeNode flag to the given mergeNode
.
setMergeNode
is used when:
KStreamImpl
is requested to merge
Demo¶
import org.apache.kafka.streams.StreamsBuilder
// Without this class the following would not be available
// due to `protected` access level
class MyStreamsBuilder extends StreamsBuilder {
val root = internalStreamsBuilder.root
}
val builder = new MyStreamsBuilder
builder.root
scala> println(builder.root)
StreamsGraphNode{nodeName='root', buildPriority=null, hasWrittenToTopology=false, keyChangingOperation=false, valueChangingOperation=false, mergeNode=false, parentNodes=[]}