CCDAK practice question 16 of 25
A consumer application is using KafkaAvroDeserializer to deserialize Avro messages. What happens if message schema is not present in AvroDeserializer local cache?
Full set: 150 questionsThe KafkaAvroDeserializer is tightly integrated with the Confluent Schema Registry. When deserializing a message, it first reads a magic byte and a 4-byte schema identifier (ID) prepended to the message payload. It then checks its local cache for the schema associated with this ID. If the schema is not found in the cache (a cache miss), the deserializer makes a network request to the Schema Registry to fetch the writer's schema using that ID. Once retrieved, the schema is used for deserialization and is also added to the local cache to optimize performance for subsequent messages using the same schema ID.
A. Throws SerializationException This is incorrect because the component is a deserializer. An exception related to serialization would be thrown by a serializer, not during the deserialization process.
B. Fails silently This is incorrect. Failing silently would lead to data loss or corruption without notification, which is contrary to the design principles of robust data processing systems like Apache Kafka and the Confluent Platform.
C. Throws DeserializationException This is incorrect as the first action. A DeserializationException would be thrown only if the subsequent attempt to fetch the schema from the Schema Registry fails (e.g., the registry is unavailable, or the schema ID is invalid) or if the message payload cannot be decoded using the fetched schema. ---
1. Confluent Documentation, "Schema Registry Overview": In the "How Schema Registry Works" section, the consumer workflow is described: "The consumer receives the message with the schema ID. If the consumer has not seen this schema ID before, it requests the schema from the Schema Registry. The consumer caches the schema. The consumer uses the schema to deserialize the message."
Source: Confluent, Inc. (2023). Schema Registry Overview. Confluent Documentation. Retrieved from https://docs.confluent.io/platform/current/schema-registry/index.html#how-schema-registry-works
2. Confluent Documentation, "Schema Registry Wire Format": This document details the on-the-wire format for Avro messages, which includes a magic byte and the schema ID. It implicitly confirms the deserializer's need to use this ID to look up the schema. The deserializer's logic is to use this ID to fetch the schema if not locally available.
Source: Confluent, Inc. (2023). Schema Registry Wire Format. Confluent Documentation. Retrieved from https://docs.confluent.io/platform/current/schema-registry/fundamentals/wire-format.html (See section on "Wire format for Avro, Protobuf, and JSON Schema").
3. Confluent Developer Tutorials, "Apache Kafka and Schema Registry": Tutorials and developer guides consistently explain this behavior. For instance, in the "Consumers using Avro" section, it is stated: "The KafkaAvroDeserializer reads the schema ID from the message. If the schema is not in its local cache, it will query Schema Registry for that schema using the ID. If the schema is not found in Schema Registry, it will result in an error. If the schema is found, it will be used to deserialize the message payload and the schema will be cached."
Source: Confluent, Inc. (2023). Getting Started with Apache Kafka and Schema Registry. Confluent Developer. Retrieved from https://developer.confluent.io/get-started/java/#consumers-using-avro
Keep practicing
Take the free CCDAK practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CCDAK practice questions
- Question 1In Avro, removing or adding a field that has a default is a __ schema evolution
- Question 2A topic has three replicas and you set min.insync.replicas to 2. If two out of three repl…
- Question 3To get acknowledgement of writes to only the leader partition, we need to use the config.…
- Question 4A customer has many consumer applications that process messages from a Kafka topic. Each …
- Question 5What information isn't stored inside of Zookeeper? (select two)
- Question 6If you enable an SSL endpoint in Kafka, what feature of Kafka will be lost?
