Kafka consumer provides an explicit unsubscribe() method to stop listening to all topics.
Step 2: Check other options
subscribe(Collections.emptyList()) is not guaranteed to unsubscribe; subscribe(null) causes error; closing consumer ends consumption but is not unsubscribing.
Final Answer:
Call consumer.unsubscribe(); -> Option B
Quick Check:
Use unsubscribe() to stop all topic subscriptions [OK]
Quick Trick:Use unsubscribe() to clear all topic subscriptions [OK]
Common Mistakes:
Passing empty list to subscribe() expecting unsubscribe
Passing null to subscribe() causing error
Confusing closing consumer with unsubscribing
Master "Consumers" in Kafka
9 interactive learning modes - each teaches the same concept differently