返回到文章
优化格式

记录

编辑于 1年前

如题,在没进入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"})

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

如题,在没进入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使用@KafkaListener方式监听,方法进不去直接报错

kafka

如题,在没进入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"})

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