简体   繁体   English

暂停与多个消费者的kafka主题

[英]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. 我有一个关于多个分区的主题和该主题的4个消费者都在同一个消费者群组中。 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. 如果是的话,如果一个人取消暂停,所有其他消费者都会取消暂停。

The pause() and resume() operations in the KafkaConsumer don't generate any request at protocol level with the Kafka broker. KafkaConsumer中的pause()和resume()操作不会在协议级别与Kafka代理生成任何请求。 Calling pause(), just set as paused the assigned partition locally marking them as "not fetchable". 调用pause(),只是将指定的分区设置为暂停,在本地将它们标记为“不可获取”。 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). Kafka协议有一个Fetch请求,用于询问从客户端到服务器获取记录(这是在poll()方法中发生的事情)。 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. 经纪人不知道你在消费者身上调用了pause()。 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. 所以答案是否定的:即使因为pause()在分区级别而不是作为一个整体的主题级别,其他消费者也不会被暂停。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM