Переглянути джерело

逻辑更改,根据业务返回成功或失败,确定队列是否消费成功与否
2019年5月30日20:24:58

herryhaixiao 5 роки тому
батько
коміт
c58d36bdab

+ 7 - 2
elab-mq/src/main/java/com/elab/mq/listener/AbstractMessageListener.java

@@ -113,8 +113,13 @@ public abstract class AbstractMessageListener implements MessageListener {
             logger.info("更新消费者数据: " + ObjectUtils.objectParseJsonStr(oldConsumerEntity));
             action = consume0(messageModel, consumeContext);
 
-            oldConsumerEntity.setConsumerStatus(1);
-            consumerDao.updateById(oldConsumerEntity);
+            if (Action.ReconsumeLater.equals(action)) {
+                oldConsumerEntity.setConsumerStatus(-1);
+                consumerDao.updateById(oldConsumerEntity);
+            } else {
+                oldConsumerEntity.setConsumerStatus(1);
+                consumerDao.updateById(oldConsumerEntity);
+            }
         } catch (Exception e) {
             logger.debug("消息处理异常 : " + action);
             e.printStackTrace();