From 3378b4c2164e38b4b7a82a54d874b5742792b680 Mon Sep 17 00:00:00 2001 From: xinzirun Date: Sun, 6 Oct 2024 09:57:22 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E6=B7=BB=E5=8A=A0=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E4=B8=8B=E7=BA=BF=E7=9B=91=E5=90=AC=E6=B6=88=E8=B4=B9=E8=80=85?= =?UTF-8?q?=20fix():=20=E8=A7=A3=E5=86=B3=E4=BE=9D=E8=B5=96=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/consumer/GoOfflineConsumer.java | 40 +++++++++ pom.xml | 89 ++++++++++++++++++- 2 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOfflineConsumer.java diff --git a/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOfflineConsumer.java b/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOfflineConsumer.java new file mode 100644 index 0000000..7c66491 --- /dev/null +++ b/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOfflineConsumer.java @@ -0,0 +1,40 @@ +package com.muyu.event.process.consumer; + +import com.muyu.event.process.util.CacheUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; + +/** + * @Author: zi run + * @Date 2024/10/5 12:50 + * @Description 车辆下线消费者 + */ +@Slf4j +@RequiredArgsConstructor +public class GoOfflineConsumer { + + /** + * 缓存工具 + */ + private final CacheUtil cacheUtil; + + /** + * 处理车辆下线事件 + * + * @param vin 车辆的识别码,用于从缓存中移除相应的数据 + */ + @RabbitListener( + bindings = @QueueBinding( + value = @Queue(value = "GO_OFFLINE", durable = "true"), + exchange = @Exchange(value = "OFFLINE_EXCHANGE", type = "fanout") + ) + ) + public void offline(String vin) { + log.info("清除缓存,车辆vin: {}", vin); + cacheUtil.remove(vin); + } +} diff --git a/pom.xml b/pom.xml index 473f6f4..88340cb 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,16 @@ 4.1.0 2.4.1 2.2.8 + 5.1.8 + 0.3.2 + 0.0.1 + 0.2.21 + 3.10.1 + 3.0.0 + 1.3.1 + 1.4.13 + 1.2.5 + 3.1.8 @@ -190,6 +200,76 @@ ${swagger.an.jakarta.verison} + + + com.github.yulichang + mybatis-plus-join + 1.4.13 + + + + + org.apache.kafka + kafka-clients + ${kafka.clients.verison} + + + + + org.apache.iotdb + iotdb-session + ${iotdb.session.verison} + + + + + com.aliyun + ecs20140526 + ${ecs20140526.version} + + + + + com.aliyun + tea-openapi + ${tea-openapi.version} + + + + + com.aliyun + tea-console + ${tea-console.version} + + + + + com.aliyun + tea-util + ${tea-util.version} + + + + + com.aliyun + cloudapi20160714 + ${cloudapi20160714.version} + + + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + ${org.eclipse.paho.client.mqttv3.version} + + + + + com.github.ben-manes.caffeine + caffeine + ${caffeine.version} + + com.muyu @@ -281,6 +361,13 @@ ${muyu.version} + + + com.muyu + cloud-common-kafka + ${muyu.version} + + com.muyu @@ -295,7 +382,7 @@ ${muyu.version} - + com.muyu cloud-modules-enterprise-common