Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One or more schemas per topic when using Schema Registry with Kafka, and Avro...?

There is somethigng I'm trying to understand about how Avro-serialized messages are treated by Kafka and Schema Registry - from this post I've understood the schema ID is stored in an predictable place in each message so it seems that we can have messages of varous schemas in the same topic and be able to find the right schema and deserialize them successfully based on just that. On the other hand I see many people seem to be using expression "a schema attached to a topic", this however implies one schema per topic..

So which is right? Can I take advantages of the Schema Registry (like i.e. KSql) and have messages of various types (or schemas) in the same topic?

like image 460
Michal Pawluk Avatar asked Dec 23 '22 01:12

Michal Pawluk


1 Answers

Typically you have 1:1 topic/schema relationship, but it is possible (and valid) to have multiple schemas per topic in some situations. For more information, see https://www.confluent.io/blog/put-several-event-types-kafka-topic/

like image 181
Robin Moffatt Avatar answered May 08 '23 19:05

Robin Moffatt