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

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.
主站蜘蛛池模板: 盐亭县| 淮阳县| 花垣县| 德安县| 化隆| 改则县| 双牌县| 阿拉善左旗| 渑池县| 敖汉旗| 蓝山县| 英德市| 搜索| 绥芬河市| 牟定县| 临漳县| 来安县| 长寿区| 和田县| 顺平县| 集贤县| 铜川市| 阿克陶县| 十堰市| 孝感市| 广州市| 龙川县| 介休市| 正蓝旗| 余干县| 新巴尔虎左旗| 遂平县| 娱乐| 二手房| 东方市| 华宁县| 扶绥县| 莱西市| 长武县| 开封市| 昌图县|