Skip to content
目录概览

Broker如何处理拉取请求的?

Consumer首次请求Broker Broker中是否有符合条件的消息

    • 响应 Consumer
    • 等待下次 Consumer 的请求
  • 没有

    • DefaultMessageStore#ReputMessageService#run方法
    • PullRequestHoldService 来 Hold 连接,每个 5s 执行一次检查 pullRequestTable 有没有消息,有的话立即推送
    • 每隔 1ms 检查 commitLog 中是否有新消息,有的话写入到 pullRequestTable
    • 当有新消息的时候返回请求
    • 挂起 consumer 的请求,即不断开连接,也不返回数据
    • 使用 consumer 的 offset,