簡體   English   中英

Kafka 排除要訂閱的主題

[英]Kafka exclude topics to subscribe to

目前我正在使用這個“正則表達式”來消耗多個 topcis: ^device-*

這個正則表達式讓我訂閱

device-gnt-q100-a
device-gnt-q100-a-commands
device-ant-q100-b
device-ant-q100-b-commands
device-ant-q535-a
device-dnq-qpo-def
device-dnq-qpo-def-commands
device-gda-qpp001-xyz
device-gda-qpp001-xyz-commands

是否有可能以某種方式排除所有以 -commands 結尾的主題?

試過沒有成功:

^(?!device-\w*-commands)device-*
^(?!.*[-]commands$)device-.*$

這應該工作: ^(?!device-\w*-commands)device-*

librdkafka 使用的正則表達式庫中有一個錯誤,該錯誤在負前瞻時失敗。 我找到了一個適用於我的情況的解決方案,盡管它在丑陋的一面:

^device-.*([^s]|[^d]s|[^n]ds|[^a]nds|[^m]ands|[^m]mands|[^o]mmands|[^c]ommands)$

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM