1
votes

Are there examples of configuring SpecificAvroSerdes (or any schema registry-based serdes - JsonSchema and Protobuf) in spring-kafka that allow leveraging some of the autoconfiguration (based on yaml or properties files).

There are a few similar questions in SO like How to use Spring-Kafka to read AVRO message with Confluent Schema registry?

But I want to be a bit specific on Kafka Streams serdes and declarative configuration of the Serdes.

Thank you

1

1 Answers

0
votes

Looks like Kafka Streams can be configured with the default Serde. See StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG and StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG.

According Spring Boot convention we can provide any arbitrary properties from YAML file: https://docs.spring.io/spring-boot/docs/2.4.0/reference/html/spring-boot-features.html#boot-features-kafka-extra-props

So, probably your SpecificAvroSerdes can be configured in the application.properties like this:

spring.kafka.streams.properties[default.value.serde]=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerdes