[英]Mongo kafka connector, deserializer question
I am using kafka connect in order to read data from mongo and write them to kafka topic.我正在使用 kafka connect 来从 mongo 读取数据并将它们写入 kafka 主题。 I am using the mongo kafka source connector.
我正在使用 mongo kafka 源连接器。 The message coming to my listener throws following exception when i am trying to deserializer.
当我尝试反序列化时,发送给我的听众的消息会引发以下异常。
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value
why is the above error?为什么会出现上述错误?
my connectors had org.apache.kafka.connect.json.JsonConverter
instead of org.apache.kafka.connect.storage.StringConverter
This solved the problem.我的连接器有
org.apache.kafka.connect.json.JsonConverter
而不是org.apache.kafka.connect.storage.StringConverter
这个问题解决了。
Also in the spring when initializing the JsonDeserializer pass in the custom objectMapper for example like below同样在 spring 中,在自定义 objectMapper 中初始化 JsonDeserializer 传递时,例如如下所示
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.registerModule(new JavaTimeModule());
hope this helps someone希望这可以帮助某人
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.