Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to configure the producer to use schema validation.
Kafka
props.put("schema.registry.url", [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Kafka broker address instead of schema registry URL.
Omitting the protocol (http://) in the URL.
✗ Incorrect
The schema registry URL is usually set to the HTTP endpoint where the schema registry service runs, commonly at port 8081.
2fill in blank
mediumComplete the code to set the producer's key serializer for Avro schema validation.
Kafka
props.put("key.serializer", [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using StringSerializer instead of KafkaAvroSerializer for Avro data.
Using ByteArraySerializer which does not validate schema.
✗ Incorrect
For Avro schema validation, the KafkaAvroSerializer from Confluent is used to serialize keys or values.
3fill in blank
hardFix the error in the producer configuration to enable schema validation for the value serializer.
Kafka
props.put("value.serializer", [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using KafkaAvroDeserializer instead of KafkaAvroSerializer for producer value serializer.
Using StringSerializer which does not validate Avro schema.
✗ Incorrect
The value serializer must be KafkaAvroSerializer to serialize data with schema validation before sending to Kafka.
4fill in blank
hardFill both blanks to create a producer configuration that enables schema validation and sets the schema registry URL.
Kafka
props.put([1], [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing bootstrap servers with schema registry URL.
Using Kafka broker address instead of schema registry URL.
✗ Incorrect
The property key for schema registry URL is "schema.registry.url" and the value is the URL string like "http://localhost:8081".
5fill in blank
hardFill all three blanks to configure a Kafka producer with schema validation for both key and value serializers and the schema registry URL.
Kafka
props.put("key.serializer", [1]); props.put("value.serializer", [2]); props.put("schema.registry.url", [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using StringSerializer for key or value when Avro schema validation is needed.
Not setting the schema registry URL or setting it incorrectly.
✗ Incorrect
Both key and value serializers should be KafkaAvroSerializer for schema validation, and the schema registry URL must be set correctly.