[英]Cannot get a joined Kafka stream to run or output anything
For the below code, both stream1 and stream2 run fine individually and I can see output, but the joined stream just doesn't log anything at all. 对于下面的代码,stream1和stream2都可以单独运行,我可以看到输出,但是连接的流根本不记录任何内容。 I have a feeling it has something to do with the join window, but the data from both streams comes in at almost exactly the same time.
我觉得它与连接窗口有关,但来自两个流的数据几乎完全同时出现。
val stream = builder.stream(stringSerde, byteArraySerde, "topic")
val stream1 = stream
.filter((key, value) => somefilter(key, value))
.through(stringSerde, byteArraySerde, "topic1")
val stream2 = stream
.filter((key, value) => someotherfilter(key, value))
.through(stringSerde, byteArraySerde, "topic2")
val joinedStream = stream1
.join(stream2, (value1: Array[Byte], value2: Array[Byte]) => {
println("wont print anything")
return somerandomdata
},
JoinWindows.of("othertopic").within(10000L),
stringSerde, byteArraySerde, byteArraySerde)
Shouldn't the keys of both topic be te same in order to join them? 这两个主题的密钥不应该相同才能加入它们吗?
I think the Javadoc explains this : https://kafka.apache.org/0102/javadoc/org/apache/kafka/streams/kstream/JoinWindows.html 我认为Javadoc解释了这个: https : //kafka.apache.org/0102/javadoc/org/apache/kafka/streams/kstream/JoinWindows.html
This might also be an interesting read : https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Join+Semantics 这可能也是一个有趣的读物: https : //cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Join+Semantics
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.