Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pausing a kafka topic with multiple consumers

I have one topic on multiple partitions and 4 consumers of that topic all in the same consumer group. If one consumer pauses the topic, will the other three consumers get paused. If there a way to do this? If yes, Conversly if one unpauses will all other consumers get unpaused.

like image 976
mrmannione Avatar asked Jul 18 '17 13:07

mrmannione


1 Answers

The pause() and resume() operations in the KafkaConsumer don't generate any request at protocol level with the Kafka broker. Calling pause(), just set as paused the assigned partition locally marking them as "not fetchable". The Kafka protocol has a Fetch request for asking from client to server to get records (it's something that happens in the poll() method). When assigned partitions are paused, they are considered "not fetchable" so the Fetch request isn't sent. There is no communication between the consumer and the broker; the broker doesn't know that you called pause() on consumer. So the answer is no : the other consumer won't be paused even because pause() is at partitions level not as topic level as a whole.

like image 99
ppatierno Avatar answered Nov 12 '22 18:11

ppatierno