1

I need the headers in every topic for object mapping purposes. Currently when I add a header to a record in a processor, then the header will be present in the target output topic, but not in changelog topics used by state stores. How can the headers be forwarded to each and every derived internal topic.

Andras Hatvani
  • 4,346
  • 4
  • 29
  • 45

1 Answers1

0

Unfortunately, there is no way to propagate headers to the changelog topics. The changelog is considered to be an internal topic and as such is not intended for consumption by the Streams user, so the Streams developers did not add the functionality you're asking about.

If I might ask, what is the use-case? There might be a different work-around.

cmcnealy
  • 312
  • 1
  • 7
  • I’ve eliminated the SerDes from the streams to let the code solely focus on the business functionality. Instead I use type resolver in each project declared via spring.json.value.type.method . This method receives the topic name, the headers and the payload as parameters. Reading the event type from the headers is the most efficient and concise way to do it. – Andras Hatvani Jan 27 '23 at 18:26
  • Got it. Unfortunately that particular way of doing things isn't supported in Streams because (as your original question pointed out) it's not possible to modify the structure of the messages in the internal changelog topic. – cmcnealy Jan 31 '23 at 19:07
  • potential use case would be to track messages as they go into changelogs - if you do want changelogs to have header information and you need to somehow have a different process that can inject those headers before producing while retaining information from where that message came from – TheOkayCoder Mar 29 '23 at 19:24