feat 17个异常故障 发送到RabbitMQ 交换机 开始队列 以及 故障恢复正常发送到RabbitMQ 交换机 结束队列

master
rouchen 2024-06-22 11:31:51 +08:00
parent b15c00b495
commit df8950f19d
10 changed files with 4696 additions and 55188 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -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;
}

View File

@ -1,10 +0,0 @@
package com.muyu.errorAlarm.service;
/**
* errorAlarmService
*
* @author Yangle
* Date 2024/6/20 11:26
*/
public interface ErrorAlarmService {
}

View File

@ -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 {
}

View File

@ -1,5 +1,6 @@
package com.muyu.event.common;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -20,6 +21,11 @@ import java.util.Date;
@SuperBuilder
public class Fault {
private String vin;
private String faultName;
private String faultTime;
private String faultCode;
@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;
}

View File

@ -1,10 +0,0 @@
package com.muyu.event.listen;
/**
* RabbitMqListen
*
* @author Yangle
* Date 2024/6/21 19:06
*/
public class RabbitMqListen {
}

View File

@ -1,5 +1,7 @@
package com.muyu.event.redis;
import com.alibaba.fastjson.JSON;
import com.muyu.event.common.Fault;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
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.stereotype.Component;
import java.util.Date;
/**
* RedisKeyExpirationListener
*
@ -34,9 +38,14 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListen
public void onMessage(Message message, byte[] pattern) {
log.info("过期redis数据" + message.toString());
try {
String key = message.toString();
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) {
e.printStackTrace();
log.error("【修改支付订单过期状态异常】:" + e.getMessage());

File diff suppressed because it is too large Load Diff

View File

@ -30,13 +30,13 @@ public class RabbitConfig {
@Primary
@Bean
public Queue autoDeleteQueue1() {
return new Queue("discover_time", true);
return new Queue("discover_time", true,true,true);
}
@Primary
@Bean
public Queue resolve_time() {
return new Queue("resolve_time", true);
return new Queue("resolve_time", true,true,true);
}
@Primary
@Bean
@ -45,20 +45,21 @@ public class RabbitConfig {
}
@Primary
@Bean
public Binding binding(DirectExchange directExchange,
Queue autoDeleteQueue1 ) {
return BindingBuilder.bind(autoDeleteQueue1)
.to(directExchange)
.with("with");
public Binding binding( ) {
return BindingBuilder.bind(autoDeleteQueue1())
.to(directExchange())
.with("discover_time");
}
@Primary
@Bean
public Binding resolve_time(DirectExchange directExchange,
Queue resolve_time ) {
return BindingBuilder.bind(resolve_time)
.to(directExchange)
public Binding resolve_times() {
return BindingBuilder.bind(resolve_time())
.to(directExchange())
.with("resolve_time");
}
}