Apache Kafka : Processor generates multiple output per input

364 Views Asked by At

I have a Kafka stream processor that has to take one item as input, and produces multiple item as output. What is the right way to code it ? Are multiple calls to this.context().forward(key, item) the right way to do it, or is there another cheat ?

Thanks.

1

There are 1 best solutions below

0
On

For Processor API, context.forward(key, item) is correct.

For DSL, you could also use KStream#flatMapValues() or KStream()flatMap().