Complete the code to specify the deserializer for the Kafka consumer.
props.put("value.deserializer", [1]);
The value.deserializer property must be set to the class that converts bytes to the desired object. Here, StringDeserializer is correct for string values.
Complete the code to create a Kafka consumer with the correct deserializer for keys.
Consumer<String, String> consumer = new KafkaConsumer<>(props, new [1](), new StringDeserializer());The key deserializer must match the key type. Here, keys are strings, so StringDeserializer is correct.
Fix the error in the deserializer class name to correctly deserialize JSON messages.
props.put("value.deserializer", [1]);
To deserialize JSON, use JsonDeserializer. Using JsonSerializer or serializers causes errors.
Fill both blanks to configure the consumer to deserialize keys as strings and values as JSON.
props.put("key.deserializer", [1]); props.put("value.deserializer", [2]);
Keys are strings, so use StringDeserializer. Values are JSON, so use JsonDeserializer.
Fill all three blanks to create a Kafka consumer that deserializes keys as strings, values as JSON, and sets the group ID.
props.put("key.deserializer", [1]); props.put("value.deserializer", [2]); props.put("group.id", [3]);
Set key deserializer to StringDeserializer, value deserializer to JsonDeserializer, and provide a group ID string.