Migrate KStream.branch() to KStream.split()

Proprietary

Kafka Streams 2.8 deprecated KStream.branch(Predicate...) in favor of KStream.split() (KIP-418), and Kafka 4.0 removed it. Rewrites a KStream[] declared from branch() to fill the same array through split() and Branched.withConsumer, so every use of the array keeps working, and rewrites a branch() whose result is unused to a split() chain. Records still go to the first branch whose predicate matches and are dropped when none does, and the topology consumes as many processor indexes as before, so generated state store and topic names do not change. With Named, the branch processors keep their names.

io.moderne.kafka.streams.MigrateKStreamBranchToSplit
mod run . --recipe=io.moderne.kafka.streams.MigrateKStreamBranchToSplit

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.