Kafka 學習筆記之 Consumer API
阿新 • • 發佈:2017-08-02
multipl 以及 keep manage broker api kafka sum multi
Kafka提供了兩種Consumer API
- High Level Consumer API
- Low Level Consumer API(Kafka詭異的稱之為Simple Consumer API,實際上非常復雜)
1. High Level Consumer API概述
High Level Consumer API圍繞著Consumer Group這個邏輯概念展開,它屏蔽了每個Topic的每個Partition的Offset管理(自動讀取zookeeper中該Consumer group的last offset )、Broker失敗轉移以及增減Partition、Consumer時的負載均衡(當Partition和Consumer增減時,Kafka自動進行負載均衡)
2. Low Level Consumer API概述
功能更強大,復雜度高,負載均衡等都要自己實現。
- Read a message multiple times(重復讀取)
- Consume only a subset of the partitions in a topic in a process(跳讀)
- Manage transactions to make sure a message is processed once and only once(Exactly Once原語)
Kafka 學習筆記之 Consumer API