Bird
0
0

Why does Kafka's subscribe() method accept a collection of topics instead of a single topic string?

hard📝 Conceptual Q10 of 15
Kafka - Consumers
Why does Kafka's subscribe() method accept a collection of topics instead of a single topic string?
ATo enforce that consumers cannot subscribe to only one topic.
BBecause Kafka topics must always be grouped in collections.
CTo allow consumers to listen to multiple topics simultaneously.
DBecause the method internally converts strings to collections automatically.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kafka consumer subscription design

    Kafka consumers often need to listen to multiple topics at once for flexibility.
  2. Step 2: Analyze the purpose of collection parameter

    Accepting a collection allows subscribing to one or many topics in a single call.
  3. Final Answer:

    To allow consumers to listen to multiple topics simultaneously. -> Option C
  4. Quick Check:

    subscribe() accepts collections for multi-topic listening [OK]
Quick Trick: subscribe() uses collections to support multiple topics [OK]
Common Mistakes:
  • Thinking Kafka requires grouped topics always
  • Believing consumers cannot subscribe to single topics
  • Assuming automatic conversion of strings to collections

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes