KStream将记录发送到多个流(不是分支) [英] KStream send record to multiple streams (not Branch)
本文介绍了KStream将记录发送到多个流(不是分支)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以进行类似分支的操作,但可以将记录放置在谓词评估为true的每个输出流中? Brach将记录放置在第一个匹配项上(文档:记录被放置到一个并且在第一个匹配项上只有一个输出流).
Is there a way to make branch-like operation but to place record in each output stream which predicate evaluates to true? Brach puts record to first match (documentation: A record is placed to one and only one output stream on the first match).
推荐答案
您可以广播"并分别过滤每个流:
You can "broadcast" and filter each stream individually:
KStream stream = ...
stream1 = stream.filter(...);
stream2 = stream.filter(...);
// and so on...
如果多次使用stream
变量,则所有记录将广播到所有下游过滤器(或任何其他运算符),即,对每个记录执行每个过滤器.
If you use stream
variable multiple times, all records are broadcasted to all downstream filters (or any other operator), ie, each filter is executed for each record.
这篇关于KStream将记录发送到多个流(不是分支)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文