[英]kafka stream to ktable join
I am trying to join a 我正在尝试加入
{"value":"0","time":1.540753118800291E9,,"deviceIp":"111.111.111.111","deviceName":"KYZ1","indicatorName":"ifHCInOctets"}
keys are mapped as: 键映射为:
map((key, value) -> KeyValue.pair(value.deviceName+value.indicatorName, value))
I do a peek on the KStream and prints both key and the attributes I used. 我在KStream上进行了窥视,并打印了我使用的键和属性。 Looks all good.
看起来都不错。
KYZ1ifHCInOctets
, the combination of device name and indicator name (from above). KYZ1ifHCInOctets
,即设备名称和指标名称的组合(从上面)。 I do a toStream and then a peek on the resulting stream. Now when i do a inner join and do a peek or through/to a topic i see the key and values are mismatched. 现在,当我进行内部联接并进行窥视或遍历某个主题时,我会看到键和值不匹配。 Join doesn't seems to work,
加入似乎无效,
KStream<String, MyPojoClass> joined= datastream.join(table,
(data,table)->data
,Joined.with(Serdes.String(),myCustomSerde,Serdes.String())
);
key = XYZ1s1_TotalDiscards
Value = {"deviceName":"ABC2", "indicatorName":"jnxCosQstatTxedBytes"}
I have the exactly the same thing working through ksql, but wanted to do my own stream app. 我在通过ksql进行工作时完全一样,但是想做自己的流应用程序。
现在,对于错误的根源听起来如此愚蠢,我的PoJo类几乎没有什么静态的属性:-(,导致了错误的键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.