Branching Streams
Learn how to branch streams in a Kafka Streams topology.
We'll cover the following...
As specified in the requirements given to us, each record we receive should be treated differently, depending on whether it is an instrumental or a noninstrumental track. When we need to treat records differently in the same topology, we can use the split
operator to split a single stream into multiple streams based on a series of predicates.
You might find other tutorials or guides using an operator named branch
instead of split
. This operator is deprecated and should not be used.
The split
operator
The split
operator is powerful and flexible. It works by calling split
on the stream, followed by calls to branch
, to which we should provide a predicate. Each record is evaluated against the predicate, and is routed to the first branch for which its respective predicate ...