Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consumer Pause & Resume works on ConsumerGroup Level?

I am going through the kafka pause & resume feature present in Consumer.

I am wondering if this pause occurs for all the consumers present in a consumer group ? I have also read here that the pause state is persisted on Kafka Server for the consumer group.

If someone can answer the above questions/ point me to the right resources , it would be helpful.

like image 949
Mahiz Avatar asked Oct 29 '22 04:10

Mahiz


1 Answers

Pause is just the Consumer's own normal action, not the removal from consumer group. as the API docs said, Pause() will suspend fetching from the partition, this method does not affect partition subscription. So it won't be removed from consumer group, and won't cause the group rebalance.

if this pause occurs for all the consumers present in a consumer group, that will cause the lagEndOffset of this group for every partition of this topic will only increase in this period. Because the message model of Kafka is a PULL model, So when to fetch how to fetch is depending on the consumer. And every consumer in a same group does not influence each other when pause or resume. Because it won't cause a rebalance.

You could read this http://kafka.apache.org/documentation.html#theconsumer && http://kafka.apache.org/documentation.html#impl_consumerregistration

like image 120
GuangshengZuo Avatar answered Jan 02 '23 19:01

GuangshengZuo