在各个帧类中添加mq消息发送(部分添加用于测试)

This commit is contained in:
YAS\29473
2025-09-10 16:57:41 +08:00
parent 8e491d41ab
commit 3eb26775fc
8 changed files with 683 additions and 80 deletions

View File

@@ -0,0 +1,87 @@
package com.jsowell.common.config.mq;
import com.jsowell.common.constant.mq.ThirdPartyRabbitConstants;
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;
@Configuration
public class TopicRabbitConfig {
/**
* 定义交换机
*/
@Bean
public TopicExchange wccThirdpartyExchange() {
return new TopicExchange(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME, true, false);
}
/**
* 定义队列
*/
@Bean
public Queue realtimeDataPushQueue() {
return new Queue(ThirdPartyRabbitConstants.QUEUE_REALTIME_DATA_PUSH, true);
}
@Bean
public Queue alarmPushQueue() {
return new Queue(ThirdPartyRabbitConstants.QUEUE_ALARM_PUSH, true);
}
@Bean
public Queue chargeResultPushQueue() {
return new Queue(ThirdPartyRabbitConstants.QUEUE_CHARGE_RESULT_PUSH, true);
}
@Bean
public Queue startupChargingFailedPushQueue() {
return new Queue(ThirdPartyRabbitConstants.QUEUE_STARTUP_CHARGING_FAILED_PUSH, true);
}
@Bean
public Queue chargeOrderPushQueue() {
return new Queue(ThirdPartyRabbitConstants.QUEUE_CHARGE_ORDER_PUSH, true);
}
/**
* 队列绑定到交换机
*/
@Bean
public Binding bindRealtimeDataPush(Queue realtimeDataPushQueue, TopicExchange wccThirdpartyExchange) {
return BindingBuilder.bind(realtimeDataPushQueue)
.to(wccThirdpartyExchange)
.with("wcc.realtimeDataPush.#");
}
@Bean
public Binding bindAlarmPush(Queue alarmPushQueue, TopicExchange wccThirdpartyExchange) {
return BindingBuilder.bind(alarmPushQueue)
.to(wccThirdpartyExchange)
.with("wcc.alarmPush.#");
}
@Bean
public Binding bindChargeResultPush(Queue chargeResultPushQueue, TopicExchange wccThirdpartyExchange) {
return BindingBuilder.bind(chargeResultPushQueue)
.to(wccThirdpartyExchange)
.with("wcc.chargeResultPush.#");
}
@Bean
public Binding bindStartupChargingFailedPush(Queue startupChargingFailedPushQueue, TopicExchange wccThirdpartyExchange) {
return BindingBuilder.bind(startupChargingFailedPushQueue)
.to(wccThirdpartyExchange)
.with("wcc.startupChargingFailedPush.#");
}
@Bean
public Binding bindChargeOrderPush(Queue chargeOrderPushQueue, TopicExchange wccThirdpartyExchange) {
return BindingBuilder.bind(chargeOrderPushQueue)
.to(wccThirdpartyExchange)
.with("wcc.chargeOrderPush.#");
}
}