feat 17个异常故障 发送到RabbitMQ 交换机 开始队列 以及 故障恢复正常发送到RabbitMQ 交换机 结束队列
parent
b15c00b495
commit
df8950f19d
58757
logs/vehicle.log
58757
logs/vehicle.log
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,20 +0,0 @@
|
||||||
package com.muyu.errorAlarm.controller;
|
|
||||||
|
|
||||||
import com.muyu.errorAlarm.service.ErrorAlarmService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ErrorAlarmController
|
|
||||||
*
|
|
||||||
* @author Yangle
|
|
||||||
* Date 2024/6/20 11:25
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
public class ErrorAlarmController {
|
|
||||||
@Autowired
|
|
||||||
private ErrorAlarmService errorAlarmService;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.muyu.errorAlarm.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* errorAlarmService
|
|
||||||
*
|
|
||||||
* @author Yangle
|
|
||||||
* Date 2024/6/20 11:26
|
|
||||||
*/
|
|
||||||
public interface ErrorAlarmService {
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.muyu.errorAlarm.service.impl;
|
|
||||||
|
|
||||||
import com.muyu.errorAlarm.service.ErrorAlarmService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ErrorAlarmServiceImpl
|
|
||||||
*
|
|
||||||
* @author Yangle
|
|
||||||
* Date 2024/6/20 11:26
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ErrorAlarmServiceImpl implements ErrorAlarmService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.event.common;
|
package com.muyu.event.common;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -20,6 +21,11 @@ import java.util.Date;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
public class Fault {
|
public class Fault {
|
||||||
private String vin;
|
private String vin;
|
||||||
private String faultName;
|
private String faultCode;
|
||||||
private String faultTime;
|
@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
|
||||||
|
private Date startTime;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
|
||||||
|
private Date endTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.muyu.event.listen;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交换机的接受 RabbitMqListen
|
|
||||||
*
|
|
||||||
* @author Yangle
|
|
||||||
* Date 2024/6/21 19:06
|
|
||||||
*/
|
|
||||||
public class RabbitMqListen {
|
|
||||||
}
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.event.redis;
|
package com.muyu.event.redis;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.muyu.event.common.Fault;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -9,6 +11,8 @@ import org.springframework.data.redis.listener.KeyExpirationEventMessageListener
|
||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RedisKeyExpirationListener
|
* RedisKeyExpirationListener
|
||||||
*
|
*
|
||||||
|
@ -34,9 +38,14 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListen
|
||||||
public void onMessage(Message message, byte[] pattern) {
|
public void onMessage(Message message, byte[] pattern) {
|
||||||
log.info("过期redis数据:" + message.toString());
|
log.info("过期redis数据:" + message.toString());
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String key = message.toString();
|
String key = message.toString();
|
||||||
log.info("过期redis数据:" + key);
|
log.info("过期redis数据:" + key);
|
||||||
rabbitTemplate.convertAndSend("disconnect_connect","resolve_time",key);
|
Fault fault = Fault.builder()
|
||||||
|
.vin(key)
|
||||||
|
.endTime(new Date())
|
||||||
|
.build();
|
||||||
|
rabbitTemplate.convertAndSend("exchange_breakdown","resolve_time", JSON.toJSONString(fault));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("【修改支付订单过期状态异常】:" + e.getMessage());
|
log.error("【修改支付订单过期状态异常】:" + e.getMessage());
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,13 +30,13 @@ public class RabbitConfig {
|
||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public Queue autoDeleteQueue1() {
|
public Queue autoDeleteQueue1() {
|
||||||
return new Queue("discover_time", true);
|
return new Queue("discover_time", true,true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public Queue resolve_time() {
|
public Queue resolve_time() {
|
||||||
return new Queue("resolve_time", true);
|
return new Queue("resolve_time", true,true,true);
|
||||||
}
|
}
|
||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -45,20 +45,21 @@ public class RabbitConfig {
|
||||||
}
|
}
|
||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public Binding binding(DirectExchange directExchange,
|
public Binding binding( ) {
|
||||||
Queue autoDeleteQueue1 ) {
|
return BindingBuilder.bind(autoDeleteQueue1())
|
||||||
return BindingBuilder.bind(autoDeleteQueue1)
|
.to(directExchange())
|
||||||
.to(directExchange)
|
.with("discover_time");
|
||||||
.with("with");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Primary
|
|
||||||
@Bean
|
@Bean
|
||||||
public Binding resolve_time(DirectExchange directExchange,
|
public Binding resolve_times() {
|
||||||
Queue resolve_time ) {
|
return BindingBuilder.bind(resolve_time())
|
||||||
return BindingBuilder.bind(resolve_time)
|
.to(directExchange())
|
||||||
.to(directExchange)
|
|
||||||
.with("resolve_time");
|
.with("resolve_time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue