diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml b/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml index 2eb1549..55191f0 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml @@ -94,6 +94,7 @@ com.couplet couplet-common-business + diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/consumer/MsgConsumer.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/consumer/MsgConsumer.java index fb4f986..0498344 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/consumer/MsgConsumer.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/consumer/MsgConsumer.java @@ -9,18 +9,18 @@ import com.couplet.common.domain.request.RealTimeDataRequest; import com.rabbitmq.client.Channel; import lombok.extern.log4j.Log4j2; -import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.*; +import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.TimeUnit; /** @@ -33,12 +33,29 @@ import java.util.concurrent.TimeUnit; //@RabbitListener(queues = "vinQueue") public class MsgConsumer { + // 普通交换机名称 + public static final String EXCHANGE_NAME = "confirm_exchange"; + // 队列名称 + public static final String QUEUE_NAME = "vinQueue"; + + public static final String ROUTING_KEY = "key1"; + + @Bean + public DirectExchange confirmExchange() { + return new DirectExchange(EXCHANGE_NAME); + } + @Bean + public Queue confirmQueue() { + return QueueBuilder.durable(QUEUE_NAME).build(); + } + @Bean + public Binding queueBindingExchange(@Qualifier("confirmQueue") Queue confirmQueue, @Qualifier("confirmExchange") DirectExchange confirmExchange) { + return BindingBuilder.bind(confirmQueue).to(confirmExchange).with(ROUTING_KEY); + } @Autowired private StringRedisTemplate redisTemplate; @Autowired private IncidentMapper incidentMapper; - private static final Map> setMap = new HashMap<>(); - @RabbitHandler public void realTimeDataConsumer(RealTimeDataRequest realTimeDataRequest, Channel channel, Message message) throws IOException { diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java index 933d1f0..28b2399 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java @@ -68,14 +68,15 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl //获取过期的key String expireKey = coupletMsgData.toString(); redisTemplate.opsForValue().set(String.valueOf(coupletMsgData),JSON.toJSONString(coupletMsgData),10, TimeUnit.MINUTES); - - long timeMillis = System.currentTimeMillis(); log.debug("失效+key is:"+ expireKey); - log.info("故障事件结束时间:"+timeMillis); log.info("故障事件检测结束....."); - } + long timeMillis = System.currentTimeMillis(); + log.info("故障事件结束时间:"+timeMillis); log.info("故障事件检测结束....."); + log.info("故障事件结束....."); + + } /** diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java index 5eececd..97e08a3 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.java @@ -42,16 +42,10 @@ public class RealTimeDataServiceImpl implements IncidentService { log.info("实时数据事件开始....."); - if (redisTemplate.hasKey("coupletMsgData")){ - redisTemplate.delete("coupletMsgData"); + if (RealTimeJudge.isJudge(coupletMsgData.getVin())){ + log.info("[{}]开始传输实时数据", coupletMsgData.getVin()); } -// Set userId = setMap.get(coupletMsgData.getVin()); -// if (null == userId){ -// userId = new HashSet<>(); -// setMap.put(coupletMsgData.getVin(),userId); -// } -// userId.add(coupletMsgData.getUserId()); - + log.info("[{}]开始传输实时数据", coupletMsgData.getVin()); log.info("实时数据事件结束....."); diff --git a/couplet-modules/couplet-file/src/main/resources/bootstrap.yml b/couplet-modules/couplet-file/src/main/resources/bootstrap.yml index 8681657..fa968e9 100644 --- a/couplet-modules/couplet-file/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-file/src/main/resources/bootstrap.yml @@ -15,11 +15,9 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/couplet-modules/couplet-gen/src/main/resources/bootstrap.yml b/couplet-modules/couplet-gen/src/main/resources/bootstrap.yml index d2834c9..e3d77cd 100644 --- a/couplet-modules/couplet-gen/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-gen/src/main/resources/bootstrap.yml @@ -17,15 +17,11 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 # 配置文件格式 file-extension: yml # 共享配置 shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - main: - allow-bean-definition-overriding: true diff --git a/couplet-modules/couplet-job/src/main/resources/bootstrap.yml b/couplet-modules/couplet-job/src/main/resources/bootstrap.yml index 3b56a22..bb1f871 100644 --- a/couplet-modules/couplet-job/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-job/src/main/resources/bootstrap.yml @@ -4,8 +4,6 @@ server: # Spring spring: - main: - allow-bean-definition-overriding: true application: # 应用名称 name: couplet-job @@ -17,11 +15,9 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/couplet-modules/couplet-modules-mq/src/main/resources/bootstrap.yml b/couplet-modules/couplet-modules-mq/src/main/resources/bootstrap.yml index 1f550c2..c3c29ed 100644 --- a/couplet-modules/couplet-modules-mq/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-modules-mq/src/main/resources/bootstrap.yml @@ -15,11 +15,9 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 172469 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 172469 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml b/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml index 9362179..1d9a0fa 100644 --- a/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml +++ b/couplet-modules/couplet-modules-onLine/src/main/resources/bootstrap.yml @@ -15,11 +15,9 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 172469 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 172469 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml b/couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml index 94d42fc..d1064dc 100644 --- a/couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml +++ b/couplet-visual/couplet-monitor/src/main/resources/bootstrap.yml @@ -15,11 +15,9 @@ spring: discovery: # 服务注册地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 config: # 配置中心地址 server-addr: 121.89.211.230:8848 - namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4 # 配置文件格式 file-extension: yml # 共享配置