Concise description
- This interface is used to batch query the concurrency of applications, query the concurrency of a certain application, query the concurrency of a certain work interval, the concurrency of a certain server, the concurrency of a certain group, and the concurrency of various servers. It should be noted that when passing the appliIdArr parameter, other parameters become invalid
Request URL
{{adminHost:8181}}/taskInfo/getRunningCnt
Request Method
- get
Request Query Parameters
Field Name | Sample | Required | Type | Note |
---|---|---|---|---|
appliIdArr | 1196452726221832192,1196464974600339456,1199762458126843904 | No | string | Application ID list (passed in comma separated form), used for front-end overview page to obtain the running quantity of multiple applications, not used together with other parameters. It is only called once during the initial loading of the page, and then dynamically updated through websocket (see notes for detailed instructions) |
appliId | 1196452726221832192 | No | string | Application ID, when not empty, returns the number of runs for a specific application |
serverId | c255ced0be4451c5ba5524b926a53816 | No | string | When rendering node ID is not empty, return the number of runs on a specific node |
wsId | LbuVvNUK | No | string | Workspace ID, when not empty, returns the number of runs on a specific wsId |
groupId | 1194226279482654720 | No | string | Group ID, when not empty, returns the number of runs on a specific group |
includeServerRunCntList | true | No | string | Does it include the number of running nodes on the server? The default value is false. If enabled, the response time of this interface will be relatively long |
Success Response Example
{
"code": 1000,
"message": "Success",
"result": {
"runCntOnAppliList": [
{
"appliId": "1196452726221832192",
"runCnt": 0
},
{
"appliId": "1196464974600339456",
"runCnt": 0
},
{
"appliId": "1199762458126843904",
"runCnt": 0
}
],
"runCntOnAppli": {
"appliId": "1196452726221832192",
"runCnt": 0
},
"total": "0",
"runCntOnGroup": {
"groupId": "1194226279482654720",
"runCnt": 0
},
"runCntOnSvrList": [],
"runCntOnWsId": {
"runCnt": 0
},
"runCntOnSvr": {
"serverId": "c255ced0be4451c5ba5524b926a53816",
"runCnt": 0
}
}
}
Parameter Note for Success Response Example
Field Name | Type | Note |
---|---|---|
code | string | None |
message | string | None |
result | object | None |
runCtOnAppliList | array | When appliIdArr is not empty, filter out the number of application runs |
runCNtOnAppliList. AppliId | string | Application Id |
runCntOnAppliList. runCnt | string | Number of application runs |
runCtOnAppli | object | When the parameter appliId is not empty, filter out the current number of runs of the application |
runCtntOnAppli. AppliId | string | Application Id |
runCntOnAppli. runCnt | string | Number of application runs |
total | string | Total concurrency of the system |
runCtntOnGroup | object | When the parameter groupId is not empty, filter out the current number of runs for that group |
runCtntOnGroup. groupId | string | Group Id |
runcntOnGroup. runcnt | string | number of runs |
runCtOnSvrList | array | When includeServerRunCntList is true, filter out the concurrency of each server |
runCtntOnWsId | object | When the parameter wsId is not empty, filter out the current number of runs in the workspace |
runCntOnWsId. runCnt | string | number of runs |
runCtOnSvr | object | When the parameter serverId is not empty, filter out the current number of runs for that server |
runCtOnSvr. serverId | string | Server Id |
runcntOnSvr. runcnt | string | number of runs |
Note
How to dynamically update application concurrency through websocket?
//Index.vue
Step 1: Create wsUrl
let wsUrl = “http://192.168.0.28:8181/websocket/imServer“;
Step 2: Create a websocket request
this.websocketServer = IMServer(wsUrl, {
onInit: this.initIMServer,
onMessage: this.IMServerMessage
})
//Assign a value to page ws to close it after leaving the page
initIMServer(ws) {
this.ws = ws;
},
//Listen for ws messages
IMServerMessage(e) {
let data = JSON.parse(e.data);
if (data.type == “001”) {
let runCntOnAppli = data.runCntInfo.runCntOnAppli;
this.$set(this.RunCntInfos, runCntOnAppli.appliId, runCntOnAppli);
}
},
//Uninstall Event
beforeDestroy() {
window.removeEventListener(‘beforeunload’, e => this.closeWebsocket(e))
}
//Close ws
closeWebsocket: function () {
this.ws.close();
}
//IMServer.js
export const IMServer = (url, config) => {
let socket = new WebSocket(url);
socket.onopen = function (ev) {
if (config.onMessage && typeof config.onMessage == ‘function’) {
config.onInit(socket);
}
}
socket.onmessage = function (ev) {
if (config.onMessage && typeof config.onMessage == ‘function’) {
config.onMessage(ev);
}
};
socket.onclose = function (ev) {
}
}