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

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.
主站蜘蛛池模板: 瑞昌市| 芜湖县| 合江县| 宜黄县| 镇原县| 齐齐哈尔市| 武鸣县| 襄城县| 瑞丽市| 江华| 石嘴山市| 健康| 南木林县| 华宁县| 孟津县| 怀远县| 车致| 当阳市| 西乌珠穆沁旗| 醴陵市| 黄浦区| 河间市| 潞西市| 松原市| 广河县| 宜春市| 日喀则市| 东乡县| 斗六市| 秭归县| 荣昌县| 灵丘县| 五指山市| 贺州市| 麦盖提县| 双辽市| 洛阳市| 来宾市| 蕉岭县| 冕宁县| 黑水县|