【发布时间】:2017-07-12 07:51:25
【问题描述】:
我有一个主主题和多个谓词,每个谓词都有一个与之关联的输出主题。我想将每条记录发送到谓词解析为 true 的所有主题。我正在使用 Luwak 测试记录满足哪些谓词(要使用这个库,您可以使用谓词列表评估文档,它会告诉您哪些匹配 - 即我只调用一次以获得满足的谓词列表)。
我正在尝试为此使用 Kafka Streams,但 KStream 上似乎没有合适的方法(KStream#branch 仅将记录路由到单个主题)。
一种可能的方法如下:
Stream from master
Map the values into a format with the original content and the list of matching predicates
Stream to an intermediate with-matches topic
For each predicate/output topic
Stream from intermediate with-matches topic
Filter "does list of matches predicates contain predicate ID"
Map the values to just the original content
Stream to corresponding output topic
不过,这样一个中间话题似乎“笨拙”。有更好的建议吗?
我正在使用:
- Kafka v0.10.1.1
- Luwak v1.4.0
【问题讨论】:
标签: apache-kafka apache-kafka-streams