.net Kafka.Client多个Consumer Group对Topic消费不能完全覆盖研究总结(二)
依據(jù)Partition和Consumer的Rebalance策略,找到Kafka.Client Rebalance代碼塊,還原本地環(huán)境,跟蹤調試,發(fā)現(xiàn)自定義Consumer Group 的Consumer并沒有分配到PartionID,如下圖、
??
frameborder="0" scrolling="no" style="border-width: medium; width: 1px; height: 1px;">
據(jù)此,基本就可以定位到不同組Consumer無法覆蓋Partition的問題根源了。
仔細閱讀Rebalance代碼,發(fā)現(xiàn)Kafka.Client 在獲取consumer時,并沒有根據(jù)Group做篩選,獲取到的是所有組的Consumer,如下圖
(此處只有兩個不同組的Consumer類型,每個Consumer會生成五個ConsumerThreadID,用于覆蓋partition)
frameborder="0" scrolling="no" style="border-width: medium; width: 1px; height: 1px;">
定位curConsumer變量,從consumerPerTopicMap中獲取,找到consumerPerTopicMap的實現(xiàn)
此處確實沒有過濾
frameborder="0" scrolling="no" style="border-width: medium; width: 1px; height: 1px;">
增加group過濾代碼。問題解決。
frameborder="0" scrolling="no" style="border-width: medium; width: 1px; height: 1px;">
相關文章:
消息隊列 Kafka 的基本知識及 .NET Core 客戶端
.net Kafka.Client多個Consumer Group對Topic消費不能完全覆蓋研究總結(一)
原文地址:http://www.cnblogs.com/vveiliang/p/6844375.html
.NET社區(qū)新聞,深度好文,微信中搜索dotNET跨平臺或掃描二維碼關注
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結
以上是生活随笔為你收集整理的.net Kafka.Client多个Consumer Group对Topic消费不能完全覆盖研究总结(二)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: View Components as T
- 下一篇: 微软中国Azure开源开发者(深圳)研讨