[server][status]- 新增手动更新状态的代码
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package io.wdd.rpc.controller;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.wdd.common.beans.response.R;
|
||||
import io.wdd.rpc.init.ServerCacheAgentStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -14,7 +14,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.wdd.rpc.init.ServerBootUpEnvironment.*;
|
||||
import static io.wdd.rpc.init.ServerCacheAgentStatus.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -22,17 +22,19 @@ import static io.wdd.rpc.init.ServerBootUpEnvironment.*;
|
||||
@RequestMapping("/octopus/server/status")
|
||||
public class StatusController {
|
||||
|
||||
@Resource
|
||||
ServerCacheAgentStatus serverCacheAgentStatus;
|
||||
|
||||
@ApiOperation("[ Agent-状态 ] Map")
|
||||
@GetMapping("/agent/status")
|
||||
public R<Map> GetAllAgentHealthyStatus() {
|
||||
public R<Map<String, String>> GetAllAgentHealthyStatus() {
|
||||
|
||||
return R.ok(ALL_AGENT_STATUS_MAP);
|
||||
}
|
||||
|
||||
@ApiOperation("[ 状态-Agent ] Map")
|
||||
@GetMapping("/status/agent")
|
||||
public R<Map> GetHealthyStatusAgentList() {
|
||||
public R<Map<String, List<String>>> GetHealthyStatusAgentList() {
|
||||
|
||||
return R.ok(STATUS_AGENT_LIST_MAP);
|
||||
}
|
||||
@@ -51,8 +53,10 @@ public class StatusController {
|
||||
|
||||
|
||||
String data = ALL_AGENT_TOPIC_NAME_LIST.toString();
|
||||
data.replace("[","");
|
||||
data.replace("]","");
|
||||
data.replace("[",
|
||||
"");
|
||||
data.replace("]",
|
||||
"");
|
||||
return R.ok(
|
||||
data
|
||||
);
|
||||
@@ -67,5 +71,15 @@ public class StatusController {
|
||||
return R.ok(ALL_HEALTHY_AGENT_TOPIC_NAME_LIST);
|
||||
}
|
||||
|
||||
@ApiOperation("手动更新Agent的状态")
|
||||
@PostMapping("/agent/status/update")
|
||||
public R<Map<String, List<String>>> ManualUpdateAgentStatus() {
|
||||
|
||||
// 手动调用更新
|
||||
serverCacheAgentStatus.updateAgentStatusMapCache();
|
||||
|
||||
return R.ok(STATUS_AGENT_LIST_MAP);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user