kafka


streams architecture

KafkaServerStartable 类启动Kafka Broker,startup方法负责启动Broker中各个组件,包括LogManagerKafkaRequestHandlers

AtomicBoolean 型变量 isStartingUp 初始化为 falsecompareAndSet方法比较当前值是否为 false 并置为 true,可以认为是一个最简单的状态机。更新 brokerState: BrokerStateStarting

initZkClient方法建立ZooKeeper连接,createTopLevelPaths方法在ZooKeeper中预建path,


ZooKeeperClient 鼓励请求 pipeline 处理。

connectionState: States 表示ZooKeeper连接状态,包括:CONNECTING, ASSOCIATING, CONNECTED, CONNECTEDREADONLY,CLOSED, AUTH_FAILED, NOT_CONNECTED

handleRequest 方法发送请求并等待相应。


Stream