Bird
0
0

Identify the error in this partition assignment code snippet using the Sticky strategy:

medium📝 Debug Q14 of 15
Kafka - Consumer Groups

Identify the error in this partition assignment code snippet using the Sticky strategy:

assignor = StickyAssignor()
assignor.assign(partitions=[0,1,2], consumers=["C1"])
AConsumers list must be integers
BPartitions list should be empty
CStickyAssignor requires at least two consumers for assignment
DStickyAssignor does not support partition assignment
Step-by-Step Solution
Solution:
  1. Step 1: Understand StickyAssignor requirements

    Sticky strategy balances partitions among multiple consumers to minimize movement.
  2. Step 2: Check given consumers list

    Only one consumer is provided, so StickyAssignor cannot balance partitions.
  3. Final Answer:

    StickyAssignor requires at least two consumers for assignment -> Option C
  4. Quick Check:

    Sticky needs multiple consumers [OK]
Quick Trick: Sticky strategy needs multiple consumers to balance partitions [OK]
Common Mistakes:
  • Assuming single consumer works with Sticky
  • Confusing consumer data types
  • Thinking Sticky doesn't assign partitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes