kafka使用@KafkaListener方式监听,方法进不去直接报错

执念灬 发表于: 2023-05-19   最后更新时间: 2023-05-22 11:55:25   1,208 游览

如题,在没进入processSmsMessage()的时候就直接抛异常

<dependency>
    <groupId>org.springframework.kafka</groupId>
    <artifactId>spring-kafka</artifactId>
    <version>2.3.7.RELEASE</version>
</dependency>
 @KafkaListener(topics = {"api-push-xxx"}, containerGroup = "apiPushSmsGroup")
    public void processSmsMessage(ConsumerRecord<String, String> record) {
        进不到方法直接会抛异常
       log.info(record)

    }

报错如下:

xxxxxxxxxx.processSmsMessage(org.apache.kafka.clients.consumer.ConsumerRecord)' threw exception; nested exception is org.springframework.dao.RecoverableDataAccessException:

Error while processing: ConsumerRecord(topic = api-push-sms, partition = 4, leaderEpoch = 24, offset = 101373242, CreateTime = 1684474859066, serialized key size = -1, serialized value size = 674, headers = RecordHeaders(headers = [], isReadOnly = false), key = null, value = {"xxxxx"})

实在不知道为啥监听过来就报错,哪个大佬给指导一下,万分感谢!

  • 感觉错误不完整,应该有更多的错误,如果有可以补充一下。半兽人 1年前 回复
添加评论
你的答案

查看kafka相关的其他问题或提一个您自己的问题