Skip to content

Commit

Permalink
Merge pull request KouShenhai#1143 from KouShenhai/feat_jdk21
Browse files Browse the repository at this point in the history
style: 优化代码
  • Loading branch information
KouShenhai authored Jan 14, 2024
2 parents 4a3f6fd + fb55198 commit 9c3fe56
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

import static org.laokou.common.i18n.common.SysConstants.*;

/**
* 通知配置.
*
Expand All @@ -47,18 +49,16 @@ protected Mono<Void> doNotify(InstanceEvent event, Instance instance) {
String status = eventStatus.getStatusInfo().getStatus();
switch (status) {
// 健康检查没通过
case "DOWN" -> log.info("健康检查没通过");
case SERVICE_DOWN_STATUS -> log.info("健康检查没通过");

// 服务离线
case "OFFLINE" -> log.info("服务离线");
case SERVICE_OFFLINE_STATUS -> log.info("服务离线");

// 服务上线
case "UP" -> log.info("服务上线");
case SERVICE_UP_STATUS -> log.info("服务上线");

// 服务未知异常
case "UNKNOWN" -> log.error("服务未知异常");
default -> {
}
case SERVICE_UNKNOWN_STATUS -> log.error("服务未知异常");
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,24 @@ private SysConstants() {
*/
public static final String DEFAULT_PASSWORD = "laokou123";

/**
* 服务没通过健康检查.
*/
public static final String SERVICE_DOWN_STATUS = "DOWN";

/**
* 服务离线.
*/
public static final String SERVICE_OFFLINE_STATUS = "OFFLINE";

/**
* 服务上线.
*/
public static final String SERVICE_UP_STATUS = "UP";

/**
* 服务未知异常.
*/
public static final String SERVICE_UNKNOWN_STATUS = "UNKNOWN";

}

0 comments on commit 9c3fe56

Please sign in to comment.