Bird
0
0

Which of the following is the correct syntax to set max.poll.interval.ms to 300000 in a Java Kafka consumer properties?

easy📝 Syntax Q3 of 15
Kafka - Performance Tuning
Which of the following is the correct syntax to set max.poll.interval.ms to 300000 in a Java Kafka consumer properties?
Aprops.set("max.poll.interval.ms", "300000");
Bprops.put("max.poll.interval.ms", 300000);
Cprops.setProperty("max.poll.interval.ms", 300000);
Dprops.put("max.poll.interval.ms", "300000");
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kafka consumer config type

    Kafka consumer properties expect String values for configuration keys and values.
  2. Step 2: Correct method and value type

    Using props.put with key and String value is correct; integer must be converted to String.
  3. Final Answer:

    props.put("max.poll.interval.ms", "300000"); -> Option D
  4. Quick Check:

    Config values must be strings in props.put [OK]
Quick Trick: Use string values for Kafka config properties in Java [OK]
Common Mistakes:
MISTAKES
  • Passing integer instead of string value
  • Using non-existent props.set method
  • Confusing setProperty with put

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes