0
votes

Is it possible to forward incoming messages with custom headers from topic A to B in DSL stream processor?

I notice all of my incomming messages in topic A contains custom headers, but when I put them into topic B all headers are swallowed by stream processor.

I usestream.to(outputTopic); method to process messages.

I have found this task, which is still OPEN. https://issues.apache.org/jira/browse/KAFKA-5632?src=confmacro

1

1 Answers

0
votes

Your observation is correct. Up to Kafka 1.1, Kafka Streams drops records headers.

Record header support is added in (upcoming) Kafka 2.0 allowing to read and modify headers using the Processor API (cf. https://issues.apache.org/jira/browse/KAFKA-6850). With KAFKA-6850, record headers will also be preserved (ie, auto-forwarded) if the DSL is used.

The mentioned issue KAFKA-5632 is about header manipulation at DSL level, that is still not supported in Kafka 2.0.

To manipulate headers using the DSL in Kafka 2.0, you can mix-and-match Processor API into the DSL by using KStream#transformValues(), #transform() or #process().