fix(): 优化上下线监听
parent
7fa71097fd
commit
26c0d3d4c8
|
@ -3,6 +3,7 @@ package com.muyu.event.process.consumer;
|
||||||
import com.muyu.event.process.util.CacheUtil;
|
import com.muyu.event.process.util.CacheUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
@ -32,7 +33,7 @@ public class GoOfflineConsumer {
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
bindings = @QueueBinding(
|
bindings = @QueueBinding(
|
||||||
value = @Queue(value = "GO_OFFLINE", durable = "true"),
|
value = @Queue(value = "GO_OFFLINE", durable = "true"),
|
||||||
exchange = @Exchange(value = "OFFLINE_EXCHANGE", type = "fanout")
|
exchange = @Exchange(value = "OFFLINE_EXCHANGE", type = ExchangeTypes.FANOUT)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
public void offline(String vin) {
|
public void offline(String vin) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.muyu.event.process.constant.CacheHandlerConstants;
|
||||||
import com.muyu.event.process.util.CacheUtil;
|
import com.muyu.event.process.util.CacheUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
@ -19,7 +20,7 @@ import java.util.HashMap;
|
||||||
/**
|
/**
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
* @Date 2024/10/6 10:01
|
* @Date 2024/10/6 10:01
|
||||||
* @Description 商量上线消费者
|
* @Description 车辆上线消费者
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -53,12 +54,13 @@ public class GoOnlineConsumer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理车辆上线事件
|
* 处理车辆上线事件
|
||||||
|
*
|
||||||
* @param vin 车辆的识别码,根据识别码从缓存中存入对应的数据
|
* @param vin 车辆的识别码,根据识别码从缓存中存入对应的数据
|
||||||
*/
|
*/
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
bindings = @QueueBinding(
|
bindings = @QueueBinding(
|
||||||
value = @Queue(value = "GO_ONLINE", durable = "true"),
|
value = @Queue(value = "GO_ONLINE", durable = "true"),
|
||||||
exchange = @Exchange(value = "ONLINE_EXCHANGE", type = "fanout")
|
exchange = @Exchange(value = "ONLINE_EXCHANGE", type = ExchangeTypes.FANOUT)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
public void online(String vin) {
|
public void online(String vin) {
|
||||||
|
|
Loading…
Reference in New Issue