Last active
April 26, 2017 10:20
-
-
Save nfo/c4936a24601352db23b18653a8ccc352 to your computer and use it in GitHub Desktop.
Kafka Streams: Calling series `KStream.branch()` to route records to n topics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KStream<Key, Value>[] branches = stream.branch((k, v) -> v.getType().equals("abc")); | |
branches[0].to(keySerde, valueSerde, "topic-abc"); | |
branches = branches[1].branch((k, v) -> v.getType().equals("def")); | |
branches[0].to(keySerde, valueSerde, "topic-def"); | |
branches = branches[1].branch((k, v) -> v.getType().equals("ghi")); | |
branches[0].to(keySerde, valueSerde, "topic-ghi"); | |
// .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which version of
kafka streams
are you referring to? This is not supposed to work on0.10.0
and later as the branch with one predicate will result in one stream.