官术网_书友最值得收藏!

Message consumers

The consumer is any one who subscribes for topics in Kafka. Each consumer belongs to a consumer group and some consumer groups contains multiple consumers. Consumers are an interesting part of Kafka and we will cover them in detail.

Two consumers from the same group cannot consume message from a similar partition because it will lead to the message being consumed out of order. However, consumers from the same group can consume message from a different partition of the same topic simultaneously. Similarly, consumers from a different group can consume messages from the same partition in parallel without affecting the order of consumption.

So, it's clear that groups play an important role; in Kafka's initial version, Zookeeper was used for group management, but in the latest version, Kafka has its own group protocol built in. One of the brokers will act as a group coordinator and will be responsible for assigning and managing partitions for groups. We will talk about Zookeeper and its own protocol in later chapters specific to the consumer.

Remember that we talked about assigning an offset to a message in a partition; each consumer reads the offset and commits the offset to the group coordinator or Zookeeper. So if consumers fail for any reason, it will start from the next message of the committed offset.

Offset helps guarantee the processing of messages by consumers, which is important for most applications that cannot afford losing any message as part of their processing.
主站蜘蛛池模板: 佛坪县| 固安县| 神木县| 白银市| 五大连池市| 崇州市| 界首市| 雷山县| 扬中市| 县级市| 福贡县| 全州县| 报价| 上蔡县| 嘉义县| 沭阳县| 应城市| 安西县| 集贤县| 凤山县| 保康县| 青州市| 石城县| 博白县| 保靖县| 佛冈县| 金沙县| 万载县| 凌海市| 白城市| 阜城县| 海丰县| 九江市| 晋城| 广西| 莒南县| 偏关县| 清河县| 阿坝县| 克什克腾旗| 黄骅市|