问题描述
消费者使用@RabbitListener和@RabbitHandler监听mq队列,使用自定义实体作为接受参数,在mq控台手动发送消息。程序不会执行到消费者方法体中,并报错:
错误1:org.springframework.messaging.converter.messageConversonException:no converter found from actual payload type 'byte[]'...
错误2:no method found for class [B...
错误3:an unexpected connection driver error occured...
原因分析
浅析:通过查看错误信息,推送的消息到消费者这里是一个字节数组
解决方法
- 使用字节数组(byte[])进行接收
- 使用GenericMessage<T> 来接收:若泛型类型为自定义实体类,同样报错。愁。。。
参考文章
https://blog.csdn.net/zht741322694/article/details/82801873