In schema registry, consumer's schema could differ from the producer's, what actually it means

独自空忆成欢 提交于 2021-01-29 05:40:39

问题


While producing AVRO data to Kafka, Avro serializer writing the same schema ID in the byte array which is used while writing the data.

Kafka Consumer fetches the schema from Schema Registry based on schema ID in the byte array received. So same schema ID is used in both i.e. Producer and Consumer and so the schema.

But why many article including this one says The consumer's schema could differ from the producer's.

Please help me in understanding this.


回答1:


Kafka Consumer fetches the schema from Schema Registry based on schema ID

Only if you let the deserializer do that.

You're capable of defining your own, compatible schema in the consumer code. Therefore, it could be different and follows the rules of Avro schema evolution

schema evolution happens only during deserialization at the consumer (read). If the consumer’s schema is different from the producer’s schema, then the value or key is automatically modified during deserialization to conform to the consumer's read schema if possible.



来源:https://stackoverflow.com/questions/52356783/in-schema-registry-consumers-schema-could-differ-from-the-producers-what-act

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!