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