I use spring-cloud-stream-binder-kafka-streams version 4.0.3, I have an arbitrary amount of topics,
e.g:
topic-in-1, topic-in-2, topic-in-3
and
topic-out-1, topic-out-2, topic-out-3
and one common processing function, something like this:
@Bean
public Function<KStream<String, String>, KStream<String, String>> trace() {
return input -> input.peek((key, value) -> log.trace("Record processed {}", value));
}
I want to build 3 streams:
topic-in-1 > trace > topic-out-1
topic-in-2 > trace > topic-out-2
topic-in-3 > trace > topic-out-3
or 2:
topic-in-1, topic-in-2 > trace > topic-out-1
topic-in-3 > trace > topic-out-2
And may be there will be more of them, topic-out-4..5..6..7.. etc
I know that I can put multiple topics into destination property,
But is there a way to configure spring to use same processor/function to build processing for each topic independently? I cannot add new function with same functionality every time I want to add new stream from topic-in-N to topic-out-N, there has to be a way to reuse it.
Thank you