hezhihua73 commented on issue #561:
URL:
https://github.com/apache/rocketmq-spring/issues/561#issuecomment-1563696876
> 你的问题应该就是没有找到正确的反序列化方法,所以识别成LinkHashMap,之后调用你的
方法,所以就报转换错误`doConvertMessage(messageExt)``BaseStringMQListener.onMessage`
>
> ```
> java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to
java.lang.String
> at
com.evatmaster.biz.center.order.listener.BaseStringMQListener.onMessage(BaseStringMQListener.java:9)
> ```
>
> 你的message信息是:{"orderId":1659164170366488577,"systemType":"00"}
发送的时候明确转换成json
string则应该是:"{\"orderId\":1659164170366488577,\"systemType\":\"00\"}" 那么他就可以识别了。
>
> 不过奇怪的是,为什么行号是错误的 `BaseStringMQListener.java:9`
原来我的思路也是你这样,因为LinkHashMap转String错误异常是很典型的jackson在找不到序列化类型的时候基础转换错误;但是进入doConvertMessage之后会发现,消息序列化转换的类型是messageType,也就是对RocketMQListener实现BaseStringMQListener定义的泛型<String>,按照这个预期的话就不会有这个问题,非常的令人疑惑
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]