Consider a Kafka consumer configured with schema registry. The producer sends messages with a schema that has a field age as int. The consumer expects age as string. What happens when the consumer tries to deserialize the message?
Producer schema: {"type":"record","name":"User","fields":[{"name":"age","type":"int"}]}
Consumer schema: {"type":"record","name":"User","fields":[{"name":"age","type":"string"}]}Think about how schema registry enforces compatibility between producer and consumer schemas.
Schema registry ensures that the consumer schema is compatible with the producer schema. If the types differ (int vs string), deserialization fails with an error to prevent data corruption.
Schema evolution allows changes to data schemas over time. Which of the following best explains how schema evolution prevents data issues in Kafka?
Consider how compatibility rules help maintain data integrity when schemas change.
Schema evolution with compatibility rules ensures that changes to schemas do not break existing consumers or producers, preventing data loss or errors.
A Kafka topic receives JSON messages from multiple producers. Some producers send a field price as a number, others as a string. Consumers sometimes fail or get wrong data. What is the main cause of this issue?
Think about how schema management enforces consistent data formats.
Without schema management, producers can send inconsistent data types for the same field, causing consumers to fail or misinterpret data.
Choose the correct Avro schema snippet to define a field email that can be either a string or null.
Avro uses union types to represent nullable fields, and the default value must match the first type.
In Avro, nullable fields are defined as a union of null and the type, with null first and default null to allow missing values.
You need to update the schema of a Kafka topic used by multiple consumers. How does using a schema registry help prevent data loss or consumer failures during this update?
Think about how schema registry controls schema versions and compatibility.
Schema registry prevents incompatible schema changes by enforcing compatibility rules, so consumers can continue reading data without errors or loss.