修改报警消息

master
ZhiShuo_Lou 2023-12-05 10:02:54 +08:00
parent 869f4391a2
commit 5a6f892ce6
2 changed files with 35 additions and 51 deletions

View File

@ -1,35 +1,35 @@
//package com.god.base.server.consumer;
//
//import lombok.extern.java.Log;
//import lombok.extern.log4j.Log4j;
//import lombok.extern.log4j.Log4j2;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.amqp.rabbit.annotation.RabbitListeners;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
///**
// * Description:
// *
// * @Author: sun-cool-boy
// * @Date: 2023/11/29
// * @info:
// */
//@Component
//@Log4j2
//public class RabbitConsumer {
//
// @RabbitListener(queuesToDeclare = {@Queue("OUT_FENCE")})
// public void one(String msg){
// log.info("监听到消息:{} , 队列名:{}",msg,"OUT_FENCE");
// System.out.println(msg);
// }
//
// @RabbitListener(queuesToDeclare = {@Queue("IN_FENCE")})
// public void two(String msg){
// log.info("监听到消息:{} , 队列名:{}",msg,"IN_FENCE");
// System.out.println(msg);
// }
//}
package com.god.base.server.consumer;
import lombok.extern.java.Log;
import lombok.extern.log4j.Log4j;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.annotation.RabbitListeners;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* Description:
*
* @Author: sun-cool-boy
* @Date: 2023/11/29
* @info:
*/
@Component
@Log4j2
public class RabbitConsumer {
@RabbitListener(queuesToDeclare = {@Queue("OUT_FENCE")})
public void one(String msg){
log.info("监听到消息:{} , 队列名:{},车辆已经驶入围栏内~~~~~~",msg,"OUT_FENCE");
System.out.println(msg);
}
@RabbitListener(queuesToDeclare = {@Queue("IN_FENCE")})
public void two(String msg){
log.info("监听到消息:{} , 队列名:{},车辆已经驶出围栏外~~~~~~",msg,"IN_FENCE");
System.out.println(msg);
}
}

View File

@ -22,22 +22,6 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
rabbitmq:
port: 5672
host: 10.100.1.5
username: guest
password: guest
#这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调
publisher-confirm-type: correlated
#保证交换机能把消息推送到队列中
publisher-returns: true
virtual-host: /
#这个配置是保证消费者会消费消息,手动确认
listener:
simple:
acknowledge-mode: manual
template:
mandatory: true
logging:
level:
com.god.system.mapper: DEBUG