Integration / Apache Kafka Interview questions
How do you integrate a schema registry with Kafka producers and consumers?
A schema registry stores and versions the structured schemas (Avro, Protobuf, JSON Schema) that producers and consumers agree on for a topic's data, so the actual schema doesn't need to be repeated inside every message — a producer registers or looks up the schema once, and messages carry only a compact schema ID reference plus the encoded payload.
# producer value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer schema.registry.url=http://localhost:8081 # consumer value.deserializer=io.confluent.kafka.serializers.KafkaAvroDeserializer schema.registry.url=http://localhost:8081
On write, the Avro (or Protobuf/JSON Schema) serializer checks the schema registry, registers a new schema version if needed, and prepends the resulting schema ID to the serialized bytes. On read, the deserializer extracts that ID, fetches the matching schema from the registry (caching it locally after the first lookup), and uses it to decode the payload back into a typed object. The real operational value is compatibility enforcement: the registry can be configured to reject a schema change that would break existing consumers (e.g. removing a required field), catching a breaking data-format change at publish time instead of as a runtime deserialization failure discovered by every downstream consumer independently.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
