java Kafka DSL Kstream>Ktable连接序列化编译错误
我试图根据这个kafka documentation实现这个连接
我不知道为什么这个连接不起作用
首先,我传递了所有的值
如果未加入序列化选项,我将收到此运行时异常:
Exception in thread "StreamAPP-stream-event-b3dc5fff-abee-4fa0-92f9-e1690f8fd152-StreamThread-1" org.apache.kafka.streams.errors.StreamsException: ClassCastException while producing data to topic StreamAPP-stream-event-KSTREAM-KEY-SELECT-0000000025-repartition. A serializer (key: org.apache.kafka.common.serialization.ByteArraySerializer / value: org.apache.kafka.common.serialization.ByteArraySerializer) is not compatible to the actual key or value type (key type: br.com.calebebrim.kafka.entities.stream.sharing.registry.StreamRegistryKey / value type: br.com.calebebrim.kafka.entities.stream.sharing.stream.Event). Change the default Serdes in StreamConfig or provide correct Serdes via method parameters (for example if using the DSL,
#to(String topic, Produced<K, V> produced)
withProduced.keySerde(WindowedSerdes.timeWindowedSerdeFrom(String.class))
)
有人能帮我吗
谢谢
# 1 楼答案
解决了
我发现连接操作不能转换数据
所以,我之前只是应用了mapValues,比如: