Skip to content

Topology

Topology is a logical representation of a ProcessorTopology.

Topology is a facade to InternalTopologyBuilder (with all methods delegating to it).

Creating Instance

Topology takes no arguments to be created.

Topology is a part of the public API of Kafka Streams and can be created directly or indirectly for StreamsBuilder.

InternalTopologyBuilder

Topology creates an InternalTopologyBuilder when created.

addGlobalStore

<KIn, VIn> Topology addGlobalStore(
  StoreBuilder<?> storeBuilder,
  String sourceName,
  Deserializer<KIn> keyDeserializer,
  Deserializer<VIn> valueDeserializer,
  String topic,
  String processorName,
  ProcessorSupplier<KIn, VIn, Void, Void> stateUpdateSupplier) // (1)
<KIn, VIn> Topology addGlobalStore(
  StoreBuilder<?> storeBuilder,
  String sourceName,
  TimestampExtractor timestampExtractor,
  Deserializer<KIn> keyDeserializer,
  Deserializer<VIn> valueDeserializer,
  String topic,
  String processorName,
  ProcessorSupplier<KIn, VIn, Void, Void> stateUpdateSupplier)
  1. Uses no TimestampExtractor

addGlobalStore requests the InternalTopologyBuilder to add a global store.

addProcessor

Topology addProcessor(
  String name,
  ProcessorSupplier<KIn, VIn, KOut, VOut> supplier,
  String... parentNames)

addProcessor requests the InternalTopologyBuilder to add a processor.

If there are any state stores associated with the processor, addProcessor requests the InternalTopologyBuilder to add them.

addSource

Topology addSource(...) // (1)
  1. There are over 10 different addSources

addSource requests the InternalTopologyBuilder to add a new source (node) (with the given arguments).

Demo

import org.apache.kafka.streams.Topology
val topology = new Topology
Back to top