|
@@ -1,47 +1,47 @@
|
|
|
-//package com.fdkankan.contro.mq.listener;
|
|
|
-//
|
|
|
-//import com.alibaba.fastjson.JSONObject;
|
|
|
-//import com.fdkankan.contro.constant.DingTalkConst;
|
|
|
-//import com.fdkankan.contro.service.IBuildSceneDTService;
|
|
|
-//import com.fdkankan.rabbitmq.bean.BuildSceneFailDTMqMessage;
|
|
|
-//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;
|
|
|
-//
|
|
|
-//@Slf4j
|
|
|
-//@Component
|
|
|
-//public class DingTalkMessageListener {
|
|
|
-//
|
|
|
-// @Value("${queue.modeling.modeling-dt}")
|
|
|
-// private String queueModelingDt;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IBuildSceneDTService buildSceneDTService;
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 场景计算发送钉钉消息
|
|
|
-// * @param channel
|
|
|
-// * @param message
|
|
|
-// * @throws Exception
|
|
|
-// */
|
|
|
-// @RabbitListener(
|
|
|
-// queuesToDeclare = @Queue("${queue.modeling.modeling-dt}"),
|
|
|
-// concurrency = "${maxThread.modeling.modeling-dt}"
|
|
|
-// )
|
|
|
-// public void buildSceneDTHandler(Channel channel, Message message) throws Exception {
|
|
|
-// String messageId = message.getMessageProperties().getMessageId();
|
|
|
-// String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
-// log.info("发送钉钉消息处理,队列名:{},id:{},消息体:{}", queueModelingDt, messageId, msg);
|
|
|
-// BuildSceneFailDTMqMessage dtMessage = JSONObject.parseObject(msg, BuildSceneFailDTMqMessage.class);
|
|
|
-// buildSceneDTService.handModelFail(dtMessage.getReason(), dtMessage.getServerPath(),
|
|
|
-// dtMessage.getNum(), dtMessage.getHostName());
|
|
|
-// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.fdkankan.contro.mq.listener;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fdkankan.contro.constant.DingTalkConst;
|
|
|
+import com.fdkankan.contro.service.IBuildSceneDTService;
|
|
|
+import com.fdkankan.rabbitmq.bean.BuildSceneFailDTMqMessage;
|
|
|
+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;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class DingTalkMessageListener {
|
|
|
+
|
|
|
+ @Value("${queue.modeling.modeling-dt}")
|
|
|
+ private String queueModelingDt;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBuildSceneDTService buildSceneDTService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 场景计算发送钉钉消息
|
|
|
+ * @param channel
|
|
|
+ * @param message
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RabbitListener(
|
|
|
+ queuesToDeclare = @Queue("${queue.modeling.modeling-dt}"),
|
|
|
+ concurrency = "${maxThread.modeling.modeling-dt}"
|
|
|
+ )
|
|
|
+ public void buildSceneDTHandler(Channel channel, Message message) throws Exception {
|
|
|
+ String messageId = message.getMessageProperties().getMessageId();
|
|
|
+ String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
+ log.info("发送钉钉消息处理,队列名:{},id:{},消息体:{}", queueModelingDt, messageId, msg);
|
|
|
+ BuildSceneFailDTMqMessage dtMessage = JSONObject.parseObject(msg, BuildSceneFailDTMqMessage.class);
|
|
|
+ buildSceneDTService.handModelFail(dtMessage.getReason(), dtMessage.getServerPath(),
|
|
|
+ dtMessage.getNum(), dtMessage.getHostName());
|
|
|
+ channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
+ }
|
|
|
+}
|