|
|
@@ -1,19 +1,19 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.service;
|
|
|
+package cn.reghao.autodop.dmaster.app.service.rpc;
|
|
|
|
|
|
-import cn.reghao.autodop.common.msg.rpc.dto.app.AppStatus;
|
|
|
-import cn.reghao.autodop.common.msg.rpc.dto.app.DeployResult;
|
|
|
import cn.reghao.autodop.common.http.DefaultWebRequest;
|
|
|
import cn.reghao.autodop.common.http.WebRequest;
|
|
|
+import cn.reghao.autodop.common.msg.rpc.dto.app.AppStatus;
|
|
|
+import cn.reghao.autodop.common.msg.rpc.dto.app.DeployResult;
|
|
|
import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
|
|
|
+import cn.reghao.autodop.dmaster.app.db.repository.AppDeployingRepository;
|
|
|
+import cn.reghao.autodop.dmaster.app.db.repository.AppRunningRepository;
|
|
|
+import cn.reghao.autodop.dmaster.app.db.repository.log.BuildLogRepository;
|
|
|
+import cn.reghao.autodop.dmaster.app.db.repository.log.DeployLogRepository;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.AppDeploying;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.AppRunning;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.repository.AppDeployingRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.repository.AppRunningRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.repository.log.BuildLogRepository;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.repository.log.DeployLogRepository;
|
|
|
import cn.reghao.autodop.dmaster.app.service.bd.DeployNotifyMsg;
|
|
|
import cn.reghao.autodop.dmaster.monitor.service.MonitorService;
|
|
|
import cn.reghao.autodop.dmaster.monitor.service.job.AppHealthCheckJob;
|
|
|
@@ -28,13 +28,11 @@ import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
- * 对 AppOps Result 部分的实现
|
|
|
- *
|
|
|
* @author reghao
|
|
|
* @date 2021-07-01 20:15:57
|
|
|
*/
|
|
|
@Service
|
|
|
-public class AppOpsResultService {
|
|
|
+public class AppRpcClazzResultServiceImpl implements AppRpcClazzResultService {
|
|
|
private MonitorService monitorService;
|
|
|
private AppRunningRepository runningRepository;
|
|
|
private NotifyService notifyService;
|
|
|
@@ -44,13 +42,13 @@ public class AppOpsResultService {
|
|
|
private AppDeployingRepository deployingRepository;
|
|
|
private AppConfigQuery appConfigQuery;
|
|
|
|
|
|
- public AppOpsResultService(MonitorService monitorService,
|
|
|
- AppRunningRepository runningRepository,
|
|
|
- NotifyService notifyService,
|
|
|
- BuildLogRepository buildLogRepository,
|
|
|
- DeployLogRepository deployLogRepository,
|
|
|
- AppDeployingRepository deployingRepository,
|
|
|
- AppConfigQuery appConfigQuery) {
|
|
|
+ public AppRpcClazzResultServiceImpl(MonitorService monitorService,
|
|
|
+ AppRunningRepository runningRepository,
|
|
|
+ NotifyService notifyService,
|
|
|
+ BuildLogRepository buildLogRepository,
|
|
|
+ DeployLogRepository deployLogRepository,
|
|
|
+ AppDeployingRepository deployingRepository,
|
|
|
+ AppConfigQuery appConfigQuery) {
|
|
|
this.monitorService = monitorService;
|
|
|
this.runningRepository = runningRepository;
|
|
|
this.notifyService = notifyService;
|
|
|
@@ -61,6 +59,7 @@ public class AppOpsResultService {
|
|
|
this.appConfigQuery = appConfigQuery;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public void deployResult(DeployResult deployResult) {
|
|
|
DeployLog deployLog = DeployLog.from(deployResult);
|
|
|
deployLogRepository.save(deployLog);
|
|
|
@@ -115,11 +114,8 @@ public class AppOpsResultService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public void statusResult(AppStatus appStatus) {
|
|
|
- processAppStatus(appStatus);
|
|
|
- }
|
|
|
-
|
|
|
- private void processAppStatus(AppStatus appStatus) {
|
|
|
String appId = appStatus.getAppId();
|
|
|
String machineId = appStatus.getMachineId();
|
|
|
AppRunning appRunning = runningRepository.findByAppIdAndMachineId(appId, machineId);
|
|
|
@@ -129,15 +125,6 @@ public class AppOpsResultService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void restartResult(AppStatus appStatus) {
|
|
|
- }
|
|
|
-
|
|
|
- public void stopResult(AppStatus appStatus) {
|
|
|
- }
|
|
|
-
|
|
|
- public void startResult(AppStatus appStatus) {
|
|
|
- }
|
|
|
-
|
|
|
public void addMonitor(String appId, String machineId) {
|
|
|
String jobClassName = AppHealthCheckJob.class.getSimpleName();
|
|
|
String jobId = String.format("%s-%s-%s", appId, machineId, jobClassName);
|