|
@@ -1,67 +1,67 @@
|
|
-package com.fdkankan.contro.mq.listener;
|
|
|
|
-
|
|
|
|
-import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
-import com.fdkankan.contro.mq.service.IBuildSceneProgressService;
|
|
|
|
-import com.fdkankan.contro.mq.service.impl.BuildSceneServiceImpl;
|
|
|
|
-import com.fdkankan.contro.service.ICommonService;
|
|
|
|
-import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
|
|
-import com.google.j2objc.annotations.AutoreleasePool;
|
|
|
|
-import com.rabbitmq.client.Channel;
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
-import org.springframework.amqp.core.Message;
|
|
|
|
-import org.springframework.amqp.rabbit.annotation.Queue;
|
|
|
|
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
-
|
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.concurrent.*;
|
|
|
|
-
|
|
|
|
-@Slf4j
|
|
|
|
-@Component
|
|
|
|
-public class BuildSceneProgressListener{
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IBuildSceneProgressService buildSceneProgressService;
|
|
|
|
-
|
|
|
|
- @Value("${queue.modeling.modeling-progress-notice}")
|
|
|
|
- private String queueName;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ICommonService commonService;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 场景计算进度监听
|
|
|
|
- * @param channel
|
|
|
|
- * @param message
|
|
|
|
- * @throws Exception
|
|
|
|
- */
|
|
|
|
- @RabbitListener(
|
|
|
|
- queuesToDeclare = @Queue("${queue.modeling.modeling-progress-notice}")
|
|
|
|
- )
|
|
|
|
- public void buildSceneProgressHandler(Channel channel, Message message) throws Exception {
|
|
|
|
- String messageId = message.getMessageProperties().getMessageId();
|
|
|
|
- String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
|
- log.info("开始推送场景计算进度,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
|
|
|
|
- BuildSceneCallMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneCallMessage.class);
|
|
|
|
- String num = buildSceneMessage.getSceneNum();
|
|
|
|
- try {
|
|
|
|
- Map<String, Object> ext = buildSceneMessage.getExt();
|
|
|
|
- String uuid = (String)ext.get("uuid");
|
|
|
|
- String batchId = (String)ext.get("batchId");
|
|
|
|
- commonService.sendSceneStatus(buildSceneMessage.getSceneNum(), uuid, batchId, 3);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error("开始计算通知失败,num:{}", num, e);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-// buildSceneProgressService.monitorProgress(buildSceneMessage);
|
|
|
|
- channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
|
- log.info("推送场景计算进度完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+//package com.fdkankan.contro.mq.listener;
|
|
|
|
+//
|
|
|
|
+//import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
+//import com.alibaba.fastjson.JSONObject;
|
|
|
|
+//import com.fdkankan.contro.mq.service.IBuildSceneProgressService;
|
|
|
|
+//import com.fdkankan.contro.mq.service.impl.BuildSceneServiceImpl;
|
|
|
|
+//import com.fdkankan.contro.service.ICommonService;
|
|
|
|
+//import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
|
|
+//import com.google.j2objc.annotations.AutoreleasePool;
|
|
|
|
+//import com.rabbitmq.client.Channel;
|
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
|
+//import org.springframework.amqp.core.Message;
|
|
|
|
+//import org.springframework.amqp.rabbit.annotation.Queue;
|
|
|
|
+//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+//import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
|
+//
|
|
|
|
+//import java.nio.charset.StandardCharsets;
|
|
|
|
+//import java.util.Map;
|
|
|
|
+//import java.util.concurrent.*;
|
|
|
|
+//
|
|
|
|
+//@Slf4j
|
|
|
|
+//@Component
|
|
|
|
+//public class BuildSceneProgressListener{
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private IBuildSceneProgressService buildSceneProgressService;
|
|
|
|
+//
|
|
|
|
+// @Value("${queue.modeling.modeling-progress-notice}")
|
|
|
|
+// private String queueName;
|
|
|
|
+//
|
|
|
|
+// @Autowired
|
|
|
|
+// private ICommonService commonService;
|
|
|
|
+//
|
|
|
|
+// /**
|
|
|
|
+// * 场景计算进度监听
|
|
|
|
+// * @param channel
|
|
|
|
+// * @param message
|
|
|
|
+// * @throws Exception
|
|
|
|
+// */
|
|
|
|
+// @RabbitListener(
|
|
|
|
+// queuesToDeclare = @Queue("${queue.modeling.modeling-progress-notice}")
|
|
|
|
+// )
|
|
|
|
+// public void buildSceneProgressHandler(Channel channel, Message message) throws Exception {
|
|
|
|
+// String messageId = message.getMessageProperties().getMessageId();
|
|
|
|
+// String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
|
+// log.info("开始推送场景计算进度,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
|
|
|
|
+// BuildSceneCallMessage buildSceneMessage = JSONObject.parseObject(msg, BuildSceneCallMessage.class);
|
|
|
|
+// String num = buildSceneMessage.getSceneNum();
|
|
|
|
+// try {
|
|
|
|
+// Map<String, Object> ext = buildSceneMessage.getExt();
|
|
|
|
+// String uuid = (String)ext.get("uuid");
|
|
|
|
+// String batchId = (String)ext.get("batchId");
|
|
|
|
+// commonService.sendSceneStatus(buildSceneMessage.getSceneNum(), uuid, batchId, 3);
|
|
|
|
+// }catch (Exception e){
|
|
|
|
+// log.error("开始计算通知失败,num:{}", num, e);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//// buildSceneProgressService.monitorProgress(buildSceneMessage);
|
|
|
|
+// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
|
+// log.info("推送场景计算进度完成,队列名:{},id:{},消息体:{}", queueName, messageId, msg);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//}
|