Search code examples
apache-kafkaconfluent-schema-registryspring-cloud-stream-binder-kafka

Schema Registry with Spring cloud stream Binder and Json deserializer


I am new to Kafka and I'm trying to use schema registry and integrate with spring cloud stream binding consumer I have researched a lot and got many references but nothing really worked out. So can you please help me with it

I have a streamlistener listening to INPUT binding. I can also have a spring cloud function "function" and then have a binding "function-in-0". Doesn't matter what I use, But I want this INPUT or "function-in-0" binding consumer to have the schema registry related properties. But no matter in which path I pass them, the consumer is not able pick i guess because when i run the application I see the consumer config doesn't have these properties.

I tried passing the schema properties in many ways like: spring.cloud.stream.bindings.input.consumer.properties.schema.registry.url

spring.cloud.stream.kafka.streams.bindings.consumer.properties.schema.registry.url

spring.cloud.stream.kafka.streams.binder.consumer.properties.schema.registry.url

Nothing worked out.

Can you help by suggesting where exactly do i need to pass these schema registry configurations


Solution

  • spring.cloud.stream.kafka.binder.consumerProperties is the value mentioned in the docs, and is a map. All keys within should be in []

    spring.cloud.stream.kafka.binder.consumerProperties[schema.registry.url]=http://localhost:8081
    

    https://cloud.spring.io/spring-cloud-stream-binder-kafka/spring-cloud-stream-binder-kafka.html