簡體   English   中英

無法獲取已加入的Kafka流來運行或輸出任何內容

[英]Cannot get a joined Kafka stream to run or output anything

對於下面的代碼,stream1和stream2都可以單獨運行,我可以看到輸出,但是連接的流根本不記錄任何內容。 我覺得它與連接窗口有關,但來自兩個流的數據幾乎完全同時出現。

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)

這兩個主題的密鑰不應該相同才能加入它們嗎?

我認為Javadoc解釋了這個: https//kafka.apache.org/0102/javadoc/org/apache/kafka/streams/kstream/JoinWindows.html

這可能也是一個有趣的讀物: https//cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Join+Semantics

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM