2
我有一個主題和多個謂詞,每個主題都有一個與之關聯的輸出主題。我想將每條記錄發送給謂詞解析爲真的所有主題。我使用Luwak來測試記錄滿足哪些謂詞(要使用這個庫來評估帶有謂詞列表的文檔,並告訴你哪些謂詞匹配 - 即我只調用一次來獲得滿足謂詞的列表)。將消息流式傳輸到多個主題
我想爲此使用卡夫卡流,但似乎沒有在KStream上適當的方法(KStream#分支只將記錄路由到單個主題)。
一個可能的方法如下:
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
這種中間話題似乎「笨重」雖然。有更好的建議嗎?
我使用:
- 卡夫卡v0.10.1.1
- 魯瓦克V1.4.0