parent
688527037d
commit
3378b4c216
|
@ -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<String> 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);
|
||||
}
|
||||
}
|
89
pom.xml
89
pom.xml
|
@ -43,6 +43,16 @@
|
|||
<knife4j-openapi3.version>4.1.0</knife4j-openapi3.version>
|
||||
<xxl-job-core.version>2.4.1</xxl-job-core.version>
|
||||
<swagger.an.jakarta.verison>2.2.8</swagger.an.jakarta.verison>
|
||||
<ecs20140526.version>5.1.8</ecs20140526.version>
|
||||
<tea-openapi.version>0.3.2</tea-openapi.version>
|
||||
<tea-console.version>0.0.1</tea-console.version>
|
||||
<tea-util.version>0.2.21</tea-util.version>
|
||||
<cloudapi20160714.version>3.10.1</cloudapi20160714.version>
|
||||
<kafka.clients.verison>3.0.0</kafka.clients.verison>
|
||||
<iotdb.session.verison>1.3.1</iotdb.session.verison>
|
||||
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version>
|
||||
<org.eclipse.paho.client.mqttv3.version>1.2.5</org.eclipse.paho.client.mqttv3.version>
|
||||
<caffeine.version>3.1.8</caffeine.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
|
@ -190,6 +200,76 @@
|
|||
<version>${swagger.an.jakarta.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatisPlusJoin 依赖包 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
<version>1.4.13</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka客户端 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
<version>${kafka.clients.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- IotDB会话 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.iotdb</groupId>
|
||||
<artifactId>iotdb-session</artifactId>
|
||||
<version>${iotdb.session.verison}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ecs20140526</artifactId>
|
||||
<version>${ecs20140526.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>${tea-openapi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>${tea-console.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>${tea-util.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云创建ecs实例 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>cloudapi20160714</artifactId>
|
||||
<version>${cloudapi20160714.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mqtt3包 -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>${org.eclipse.paho.client.mqttv3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Caffeine本地缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
<version>${caffeine.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
@ -281,6 +361,13 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka模块-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-kafka</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 公共缓存模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
@ -295,7 +382,7 @@
|
|||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业业务平台 - 公告模块 -->
|
||||
<!-- 企业业务平台 - 公共模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||
|
|
Loading…
Reference in New Issue