Kafka 学习笔记之 Consumer API

mac2022-06-30  67

Kafka提供了两种Consumer API

High Level Consumer APILow 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原语)

转载于:https://www.cnblogs.com/AK47Sonic/p/7271551.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)