fix: 修复
parent
fd016cc78a
commit
7aa26d0866
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.cargateway.config;
|
||||
package com.muyu.common.rabbit.config;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.slf4j.Logger;
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.cargateway.service.Impl;
|
||||
|
||||
import com.muyu.cargateway.config.RabbitmqConfig;
|
||||
import com.muyu.common.rabbit.config.RabbitmqConfig;
|
||||
import com.muyu.cargateway.domain.VehicleConnection;
|
||||
import com.muyu.cargateway.domain.VinIp;
|
||||
import com.muyu.cargateway.domain.model.MqttServerModel;
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
package com.muyu.data.processing.config;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-10-04-15:13
|
||||
* @ Version:1.0
|
||||
* @ Description:rabbitmq配置类
|
||||
*/
|
||||
@Log4j2
|
||||
@Configuration
|
||||
public class RabbitmqConfig {
|
||||
// 日志
|
||||
private static final Logger logger = LoggerFactory.getLogger(RabbitmqConfig.class);
|
||||
|
||||
/**
|
||||
* 队列
|
||||
*/
|
||||
public static final String QUEUE_INFORM_EMAIL = "queue_inform_email";
|
||||
/**
|
||||
* 队列
|
||||
*/
|
||||
public static final String QUEUE_INFORM_SMS = "queue_inform_sms";
|
||||
/**
|
||||
* 交换机
|
||||
*/
|
||||
public static final String EXCHANGE_TOPICS_INFORM = "exchange_topics_inform";
|
||||
/**
|
||||
* 路由key
|
||||
*/
|
||||
public static final String ROUTINGKEY_EMAIL = "inform.#.email.#";
|
||||
/**
|
||||
* 路由key
|
||||
*/
|
||||
public static final String ROUTINGKEY_SMS = "inform.#.sms.#";
|
||||
|
||||
/**
|
||||
* 声明交换机,做持久化
|
||||
*/
|
||||
@Bean(EXCHANGE_TOPICS_INFORM)
|
||||
public Exchange exchangeTopicsInform() {
|
||||
try {
|
||||
Exchange exchange = ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build();
|
||||
log.info("创建的交换机为: {}", EXCHANGE_TOPICS_INFORM);
|
||||
return exchange;
|
||||
} catch (Exception e) {
|
||||
log.error("创建该: {} 交换机失败", EXCHANGE_TOPICS_INFORM, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// 声明QUEUE_INFORM_EMAIL队列
|
||||
@Bean(QUEUE_INFORM_EMAIL)
|
||||
public Queue queueInformEmail() {
|
||||
try {
|
||||
Queue queue = new Queue(QUEUE_INFORM_EMAIL);
|
||||
log.info("创建的队列为: {}", QUEUE_INFORM_EMAIL);
|
||||
return queue;
|
||||
} catch (Exception e) {
|
||||
log.error("创建该: {} 队列失败", QUEUE_INFORM_EMAIL, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// 声明QUEUE_INFORM_SMS队列
|
||||
@Bean(QUEUE_INFORM_SMS)
|
||||
public Queue queueInformSms() {
|
||||
try {
|
||||
Queue queue = new Queue(QUEUE_INFORM_SMS);
|
||||
log.info("创建的队列为: {}", QUEUE_INFORM_SMS);
|
||||
return queue;
|
||||
} catch (Exception e) {
|
||||
log.error("创建该: {} 队列失败", QUEUE_INFORM_SMS, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
//ROUTINGKEY_EMAIL队列绑定交换机,指定routingKey
|
||||
@Bean
|
||||
public Binding bindingQueueInformEmail(@Qualifier(QUEUE_INFORM_EMAIL) Queue queue,
|
||||
@Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
|
||||
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_EMAIL).noargs();
|
||||
}
|
||||
|
||||
//ROUTINGKEY_SMS队列绑定交换机,指定routingKey
|
||||
@Bean
|
||||
public Binding bindingRoutingKeySms(@Qualifier(QUEUE_INFORM_SMS) Queue queue,
|
||||
@Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
|
||||
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_SMS).noargs();
|
||||
}
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
package com.muyu.data.processing.controller;
|
||||
|
||||
import com.muyu.data.processing.config.RabbitmqConfig;
|
||||
import com.muyu.common.rabbit.config.RabbitmqConfig;
|
||||
import com.muyu.data.processing.service.DataProcessingService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
|
@ -3,13 +3,11 @@ package com.muyu.data.processing.rebbit;
|
|||
|
||||
import com.muyu.common.caffeine.enums.CacheNameEnums;
|
||||
import com.muyu.common.rabbit.constants.RabbitConstants;
|
||||
import com.muyu.data.processing.config.RabbitmqConfig;
|
||||
import com.muyu.common.rabbit.config.RabbitmqConfig;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Setter;
|
||||
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.cache.CacheManager;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
|
|
@ -32,6 +32,7 @@ public class FaultProcessingStrategy extends abstractStrategyRouter<HashMap<Str
|
|||
|
||||
@Override
|
||||
public Temporary2 apply(HashMap<String, BasicData> basicDataMap) {
|
||||
|
||||
return applyStrategy(basicDataMap);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue