This commit is contained in:
van
2026-04-21 23:37:18 +08:00
parent a10d561fcb
commit de335831d4
7 changed files with 102 additions and 36 deletions

View File

@@ -3,7 +3,7 @@ package com.ruoyi.jarvis.mq;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.jarvis.dto.GoofishNotifyMessage;
import com.ruoyi.jarvis.service.goofish.GoofishNotifyAsyncFacade;
import com.ruoyi.jarvis.service.goofish.GoofishOrderPipeline;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -12,7 +12,10 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 闲管家订单推送异步消费(需配置 rocketmq.name-server
* 闲管家订单推送消费(需配置 rocketmq.name-server
* <p>
* 在此线程内同步执行 {@link GoofishOrderPipeline#runFullPipeline},避免再投递 {@code @Async} 线程池造成
* 「MQ 堆积 + goofishTaskExecutor 排队」的双重延迟;回调 HTTP 已在 {@link com.ruoyi.jarvis.service.impl.ErpGoofishOrderServiceImpl#publishOrProcessNotify} 中快速返回。
*/
@Component
@ConditionalOnProperty(name = "rocketmq.name-server")
@@ -24,7 +27,7 @@ import javax.annotation.Resource;
public class GoofishOrderNotifyConsumer implements RocketMQListener<String> {
@Resource
private GoofishNotifyAsyncFacade goofishNotifyAsyncFacade;
private GoofishOrderPipeline goofishOrderPipeline;
@Override
public void onMessage(String message) {
@@ -36,6 +39,6 @@ public class GoofishOrderNotifyConsumer implements RocketMQListener<String> {
if (body == null) {
body = new JSONObject();
}
goofishNotifyAsyncFacade.afterNotify(m.getAppid(), body);
goofishOrderPipeline.runFullPipeline(m.getAppid(), body);
}
}