Apache Flink has a split API that lets to branch data-streams:
val splited = datastream.split { i => i match {
case i if ... => Seq("red", "blue")
case _ => Seq("green")
}}
splited.select("green").flatMap { .... }
It also provides a another approach called Side Output( https://ci.apache.org/projects/flink/flink-docs-release-1.5/dev/stream/side_output.html) that lets you do the same thing!
What's the difference between these two way? Do they use from a same lower-level construction? Do they cost the same? When and how we should select one of them?