Bird
0
0

What is wrong with this Kafka consumer deserialization setup?

medium📝 Debug Q7 of 15
Kafka - Consumers

What is wrong with this Kafka consumer deserialization setup?

props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.IntegerDeserializer");
ABoth deserializers will be used causing conflict
BNo error, this is valid configuration
CKafka supports multiple deserializers for one value
DDuplicate keys cause the first deserializer to be overwritten
Step-by-Step Solution
Solution:
  1. Step 1: Analyze duplicate property keys in configuration

    Setting the same key twice causes the first value to be overwritten by the second.
  2. Step 2: Understand effect on deserialization

    Only the last deserializer (IntegerDeserializer) will be used, possibly causing errors if data is string.
  3. Final Answer:

    Duplicate keys cause the first deserializer to be overwritten -> Option D
  4. Quick Check:

    Duplicate keys overwrite previous values in Properties [OK]
Quick Trick: Duplicate keys overwrite earlier values in Kafka configs [OK]
Common Mistakes:
  • Thinking both deserializers run together
  • Assuming Kafka merges deserializers
  • Believing this is valid multi-deserializer setup

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes