1

I have a Kafka consumer that is implemented using Spring's Kafka Streams API. The consumer looks something like this:

@Bean
public Consumer<KStream<String, Foo>> fooProcess() {
    return input -> input
        .foreach((key, value) -> {
            processFoo(value);
         });
}

The problem I'm having is that messages consumed from this topic are serialized as type some.package.foo, but my application uses some.other.package.foo. I know it's possible to map these two types using standard Spring Kafka, but I can't for the life of me figure out how to specify this mapping when using the streams API.

Any guidance would be greatly appreciated!

  • Have you tried this and got some errors? The same Spring Kafka properties you use for mapping can also be used here. However, you need to put them under `spring.cloud.sream.kafka.streams.binder.configuration.spring.json.....`. If things are still not working, please put together a small sample app and we can look into it further. – sobychacko Feb 03 '23 at 16:17

0 Answers0