yx-Yaoxaing commented on issue #595:
URL: 
https://github.com/apache/rocketmq-spring/issues/595#issuecomment-1817508753

   处理消息失败 抛出异常即可
   `public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, 
ConsumeConcurrentlyContext context) {
               for (MessageExt messageExt : msgs) {
                   log.debug("received msg: {}", messageExt);
                   try {
                       long now = System.currentTimeMillis();
                       handleMessage(messageExt);
                       long costTime = System.currentTimeMillis() - now;
                       log.debug("consume {} cost: {} ms", 
messageExt.getMsgId(), costTime);
                   } catch (Exception e) {
                       log.warn("consume message failed. messageId:{}, 
topic:{}, reconsumeTimes:{}", messageExt.getMsgId(), messageExt.getTopic(), 
messageExt.getReconsumeTimes(), e);
                       
context.setDelayLevelWhenNextConsume(delayLevelWhenNextConsume);
                       return ConsumeConcurrentlyStatus.RECONSUME_LATER;
                   }
               }
   
               return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
           }`
          rocketmq-spring 会在这里自动处理


-- 
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: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to