小编Ric*_*h P的帖子

Kafka Streams - 使用 through() 与 toStream() + to() 重用流

我想知道在 .toStream() + .to() 的流引用上使用 .through() 重用流的区别

使用 .through()

KStream<String, String> subStream = mainStream .groupByKey(..) .aggregate(..) .toStream(..); .through("aggregate-topic", ..); // Then use the (new) stream from .through() to create another topic

对比使用 .toStream() + .to()

KStream<String, String> subStream = mainStream .groupByKey(..) .aggregate(..) .toStream(..); subStream.to("aggregate-topic", ..); //reuse the existing subStream from toStream() to create another topic

我已经实现了一个使用后者的功能,因为在我学习 through() 方法之前,这是有意义的。

我现在好奇的是这两种选择的内部情况;选择一个选项而不是另一个选项有什么好处/坏处吗?

apache-kafka apache-kafka-streams

4
推荐指数
1
解决办法
1635
查看次数

标签 统计

apache-kafka ×1

apache-kafka-streams ×1