From fe78dfa6ed9f7b884914005b70f3b21e5ced0cf4 Mon Sep 17 00:00:00 2001 From: Jay <csj123456> Date: 星期六, 18 一月 2025 13:59:45 +0800 Subject: [PATCH] 修改mq注册队列 --- /dev/null | 36 ------------------------------------ shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java | 4 ++-- shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueuePredictFinishConfig.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 38 deletions(-) diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java deleted file mode 100644 index 693ca8d..0000000 --- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iailab.module.shasteel.mq.config; - -import com.iailab.module.shasteel.mq.common.constant.RoutingConstant; -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.Queue; -import org.springframework.amqp.core.TopicExchange; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @description: 电力预测完成消息队列 - * @author: dzd - * @date: 2025/1/17 17:38 - **/ -@Configuration -public class QueueElecPredictFinishConfig { - // 队列名称 - public final static String QUEUE_NAME = "IaiabFastShateel.Model.PredictFinish.Elec"; - - @Bean - public Queue predictFinishQueue() { - return new Queue(QueueElecPredictFinishConfig.QUEUE_NAME); - } - - @Bean - TopicExchange predictFinishExchange() { - return new TopicExchange(RoutingConstant.EXCHANGE); - } - - // 注意通配符*和#的用法 - @Bean - Binding bindingExchangeMessagePF() { - return BindingBuilder.bind(predictFinishQueue()).to(predictFinishExchange()).with(RoutingConstant.Iailab_Model_PredictFinish_Elec); - } -} diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueuePredictFinishConfig.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueuePredictFinishConfig.java index 334bdd7..b2bc77b 100644 --- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueuePredictFinishConfig.java +++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueuePredictFinishConfig.java @@ -18,9 +18,16 @@ // 队列名称 public final static String QUEUE_NAME = "IaiabFastShateel.Model.PredictFinish"; + public final static String QUEUE_NAME_Elec = "IaiabFastShateel.Model.PredictFinish.Elec"; + @Bean public Queue predictFinishQueue() { return new Queue(QueuePredictFinishConfig.QUEUE_NAME); + } + + @Bean + public Queue predictFinishQueueElec() { + return new Queue(QueuePredictFinishConfig.QUEUE_NAME_Elec); } @Bean @@ -33,4 +40,9 @@ Binding bindingExchangeMessagePF() { return BindingBuilder.bind(predictFinishQueue()).to(predictFinishExchange()).with(RoutingConstant.Iailab_Model_PredictFinish); } + + @Bean + Binding bindingExchangeMessageElec() { + return BindingBuilder.bind(predictFinishQueueElec()).to(predictFinishExchange()).with(RoutingConstant.Iailab_Model_PredictFinish_Elec); + } } diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java index c7da9d2..e7432ee 100644 --- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java +++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java @@ -6,7 +6,7 @@ import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; import com.iailab.module.model.enums.ScheduleTriggerMethodEnum; import com.iailab.module.shasteel.mq.common.constant.CommonConstant; -import com.iailab.module.shasteel.mq.config.QueueElecPredictFinishConfig; +import com.iailab.module.shasteel.mq.config.QueuePredictFinishConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitListener; @@ -37,7 +37,7 @@ * * @param message */ - @RabbitListener(queues = QueueElecPredictFinishConfig.QUEUE_NAME) + @RabbitListener(queues = QueuePredictFinishConfig.QUEUE_NAME) public void listen(Message message) { String messageBody = new String(message.getBody()); log.info("开始执行电力调度,messageBody:" + messageBody); -- Gitblit v1.9.3