Spring Cloud Stream: Topology and State Store

Learn how to build Kafka Streams applications using Spring Cloud Stream.

Topology

In order to create a Kafka Streams topology using Spring Cloud Stream, we need to understand three concepts:

  • Functional interfaces

  • Topology definition using functional interfaces

  • Topic binding

Spring Cloud Stream functional interfaces

In Spring Cloud Stream, the Kafka Streams topology is defined using a functional interface. This means that we define a bean with a return value that is either a Consumer<KStream<K,V> if our topology is only consuming Kafka messages, or a Function<KStream<K,V>,KStream<K,V>> if the topology is also intended to publish outcoming messages.

How do we use these interfaces? Let’s look at a simple case not related to Kafka Streams to help us understand:

Get hands-on with 1400+ tech skills courses.