Bird
0
0

Which approach best uses custom SerDes?Create a PersonSerializer that converts Person to JSON bytes.Create a PersonDeserializer that converts JSON bytes back to Person.Register these SerDes in Kafka producer and consumer configs.What is the main benefit of this approach?

hard📝 Application Q15 of 15
Kafka - Advanced Stream Processing

You want to send a complex object Person{name, age} through Kafka. Which approach best uses custom SerDes?

  1. Create a PersonSerializer that converts Person to JSON bytes.
  2. Create a PersonDeserializer that converts JSON bytes back to Person.
  3. Register these SerDes in Kafka producer and consumer configs.

What is the main benefit of this approach?

AIt speeds up Kafka message delivery
BIt allows sending complex objects as bytes safely and readably
CIt automatically partitions topics by age
DIt removes the need for Kafka brokers
Step-by-Step Solution
Solution:
  1. Step 1: Understand custom SerDes for complex objects

    Serializing to JSON bytes lets complex objects be sent as byte arrays.
  2. Step 2: Recognize benefit of JSON format

    JSON is readable and widely supported, making data safe and easy to deserialize.
  3. Step 3: Confirm Kafka config usage

    Registering SerDes ensures Kafka knows how to convert data on send and receive.
  4. Final Answer:

    It allows sending complex objects as bytes safely and readably -> Option B
  5. Quick Check:

    Custom SerDes + JSON = safe complex data transfer [OK]
Quick Trick: Use JSON SerDes for complex object safety [OK]
Common Mistakes:
MISTAKES
  • Thinking SerDes speeds up Kafka internals
  • Assuming SerDes controls topic partitions
  • Believing Kafka brokers are not needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes