简体   繁体   中英

Unable to deserialize Avro message using Confluent Schema Registry and Spring Cloud Stream

I am using Spring Cloud Stream and Confluent Schema Registry to register Avro schemas.

Schemas are registered successfully. But when my Stream Listener receives a message the payload is still in Bytes.

Here are my properties.

 spring.cloud.stream.schemaRegistryClient.endpoint=http://localhost:8081 spring.cloud.stream.bindings.output.contentType=application/*+avro spring.cloud.stream.schema.avro.dynamic-schema-generation-enabled=true spring.cloud.stream.schemaRegistryClient.cached=true spring.cloud.stream.schema.avro.schemaLocations=classpath*:schemas/*.avsc spring.cloud.stream.bindings.input.contentType=application/*+avro 

While receiving message I noticed that " convertFromInternal " in " AbstractAvroMessageConverter " never gets invoked which is suppose to decode the message.

What version of SCSt are you using? We fixed a couple of issues when integrating with confluent schema registry server on 1.3.

Also, you don't need to set the input contentType, resolution happens via headers that contain application/vnd*+avro that's the hint for the converter to kick in and find the correct schema from the server. You only set that contentType on the output channels, it gets replaced with the correct version for example: application/vnd.user.v1+avro

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM