[英]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.