Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 调用作业平台execute_job_plan等接口,JOB回调callback_url请求格式优化 #824 #840

Open
wants to merge 2 commits into
base: 3.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

package com.tencent.bk.job.common.esb.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
* 作业平台回调第三方系统信息, 如果用户传入此参数,那么此参数优先
*/
@Data
public class EsbCallbackDTO {
/**
* 回调url
*/
private String url;
/**
* content_type头,仅支持application/json和application/x-www-form-urlencoded两种,默认是application/json
*/
@JsonProperty("content_type")
private String contentType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class JobExecuteDAOImpl implements JobExecuteDAO {
TASK_INSTANCE_TABLE.APP_ID, TASK_INSTANCE_TABLE.TASK_ID,
TASK_INSTANCE_TABLE.TASK_TEMPLATE_ID, TASK_INSTANCE_TABLE.NAME, TASK_INSTANCE_TABLE.TYPE,
TASK_INSTANCE_TABLE.OPERATOR, TASK_INSTANCE_TABLE.STATUS, TASK_INSTANCE_TABLE.CURRENT_STEP_ID,
TASK_INSTANCE_TABLE.STARTUP_MODE, TASK_INSTANCE_TABLE.TOTAL_TIME, TASK_INSTANCE_TABLE.CALLBACK_URL,
TASK_INSTANCE_TABLE.STARTUP_MODE, TASK_INSTANCE_TABLE.TOTAL_TIME, TASK_INSTANCE_TABLE.CALLBACK_URL, TASK_INSTANCE_TABLE.CALLBACK,
TASK_INSTANCE_TABLE.IS_DEBUG_TASK, TASK_INSTANCE_TABLE.CRON_TASK_ID, TASK_INSTANCE_TABLE.CREATE_TIME,
TASK_INSTANCE_TABLE.START_TIME, TASK_INSTANCE_TABLE.END_TIME, TASK_INSTANCE_TABLE.APP_CODE,
TASK_INSTANCE_TABLE.ROW_CREATE_TIME, TASK_INSTANCE_TABLE.ROW_UPDATE_TIME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbGlobalVarDTO;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
Expand Down Expand Up @@ -60,6 +61,12 @@ public class EsbExecuteJobRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
if (globalVars != null && globalVars.size() > 0) {
globalVars.forEach(globalVar -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.EsbServerDTO;
Expand Down Expand Up @@ -96,6 +97,12 @@ public class EsbFastExecuteSQLRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
trimIps(this.ipList);
if (this.targetServer != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.EsbServerDTO;
Expand Down Expand Up @@ -113,6 +114,12 @@ public class EsbFastExecuteScriptRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
trimIps(this.ipList);
if (this.targetServer != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbFileSourceDTO;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
Expand Down Expand Up @@ -89,6 +90,12 @@ public class EsbFastPushFileRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

/**
* 下载限速,单位MB
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbServerDTO;
import lombok.Getter;
Expand Down Expand Up @@ -91,5 +92,11 @@ public class EsbPlatformExecuteScriptRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;


}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v2.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbFileSourceDTO;
import com.tencent.bk.job.common.esb.model.job.EsbServerDTO;
Expand Down Expand Up @@ -83,6 +84,12 @@ public class EsbPlatformPushFileRequest extends EsbReq {
@JsonProperty("bk_callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

/**
* 下载限速,单位MB
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v3.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.v3.EsbGlobalVarV3DTO;
Expand Down Expand Up @@ -60,6 +61,12 @@ public class EsbExecuteJobV3Request extends EsbReq {
@JsonProperty("callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
if (globalVars != null && globalVars.size() > 0) {
globalVars.forEach(globalVar -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v3.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.v3.EsbServerV3DTO;
Expand Down Expand Up @@ -90,6 +91,12 @@ public class EsbFastExecuteSQLV3Request extends EsbReq {
@JsonProperty("callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
if (this.targetServer != null) {
trimIps(this.targetServer.getIps());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v3.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.v3.EsbServerV3DTO;
Expand Down Expand Up @@ -114,6 +115,12 @@ public class EsbFastExecuteScriptV3Request extends EsbReq {
@JsonProperty("callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
if (this.targetServer != null) {
trimIps(this.targetServer.getIps());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v3.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.v3.EsbFileSourceV3DTO;
Expand Down Expand Up @@ -84,6 +85,12 @@ public class EsbFastTransferFileV3Request extends EsbReq {
@JsonProperty("callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

/**
* 下载限速,单位MB
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.tencent.bk.job.execute.model.esb.v3.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbCallbackDTO;
import com.tencent.bk.job.common.esb.model.EsbReq;
import com.tencent.bk.job.common.esb.model.job.EsbIpDTO;
import com.tencent.bk.job.common.esb.model.job.v3.EsbServerV3DTO;
Expand Down Expand Up @@ -85,6 +86,12 @@ public class EsbPushConfigFileV3Request extends EsbReq {
@JsonProperty("callback_url")
private String callbackUrl;

/**
* 任务执行完成之后回调参数,比callbackUrl优先级高
*/
@JsonProperty("callback")
private EsbCallbackDTO callback;

public void trimIps() {
if (this.targetServer != null) {
trimIps(this.targetServer.getIps());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public EsbResp<EsbJobExecuteDTO> executeJob(EsbExecuteJobRequest request) {
.executeVariableValues(executeVariableValues)
.startupMode(TaskStartupModeEnum.API)
.callbackUrl(request.getCallbackUrl())
.callback(request.getCallback())
.appCode(request.getAppCode())
.build());
taskExecuteService.startTask(taskInstanceDTO.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ private TaskInstanceDTO buildFastSQLTaskInstance(EsbFastExecuteSQLRequest reques
taskInstance.setType(TaskTypeEnum.SCRIPT.getValue());
taskInstance.setAppCode(request.getAppCode());
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
return taskInstance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ private TaskInstanceDTO buildFastScriptTaskInstance(EsbFastExecuteScriptRequest
taskInstance.setType(TaskTypeEnum.SCRIPT.getValue());
taskInstance.setCurrentStepId(0L);
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
taskInstance.setAppCode(request.getAppCode());
return taskInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ private TaskInstanceDTO buildFastFileTaskInstance(EsbFastPushFileRequest request
taskInstance.setCurrentStepId(0L);
taskInstance.setDebugTask(false);
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
taskInstance.setAppCode(request.getAppCode());
return taskInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public EsbResp<EsbJobExecuteV3DTO> executeJobPlan(EsbExecuteJobV3Request request
.executeVariableValues(executeVariableValues)
.startupMode(TaskStartupModeEnum.API)
.callbackUrl(request.getCallbackUrl())
.callback(request.getCallback())
.appCode(request.getAppCode())
.build());
taskExecuteService.startTask(taskInstanceDTO.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private TaskInstanceDTO buildFastSQLTaskInstance(EsbFastExecuteSQLV3Request requ
taskInstance.setType(TaskTypeEnum.SCRIPT.getValue());
taskInstance.setAppCode(request.getAppCode());
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
return taskInstance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private TaskInstanceDTO buildFastScriptTaskInstance(EsbFastExecuteScriptV3Reques
taskInstance.setType(TaskTypeEnum.SCRIPT.getValue());
taskInstance.setCurrentStepId(0L);
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
taskInstance.setAppCode(request.getAppCode());
return taskInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@
import com.tencent.bk.job.common.model.ValidateResult;
import com.tencent.bk.job.common.util.date.DateUtils;
import com.tencent.bk.job.execute.client.FileSourceResourceClient;
import com.tencent.bk.job.execute.common.constants.FileTransferModeEnum;
import com.tencent.bk.job.execute.common.constants.RunStatusEnum;
import com.tencent.bk.job.execute.common.constants.StepExecuteTypeEnum;
import com.tencent.bk.job.execute.common.constants.TaskStartupModeEnum;
import com.tencent.bk.job.execute.common.constants.TaskTypeEnum;
import com.tencent.bk.job.execute.common.constants.*;
import com.tencent.bk.job.execute.model.FileDetailDTO;
import com.tencent.bk.job.execute.model.FileSourceDTO;
import com.tencent.bk.job.execute.model.StepInstanceDTO;
Expand Down Expand Up @@ -248,6 +244,7 @@ private TaskInstanceDTO buildFastFileTaskInstance(EsbFastTransferFileV3Request r
taskInstance.setCurrentStepId(0L);
taskInstance.setDebugTask(false);
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
taskInstance.setAppCode(request.getAppCode());
return taskInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ private TaskInstanceDTO buildFastFileTaskInstance(EsbPushConfigFileV3Request req
taskInstance.setDebugTask(false);
taskInstance.setAppCode(request.getAppCode());
taskInstance.setCallbackUrl(request.getCallbackUrl());
taskInstance.setCallback(request.getCallback());
return taskInstance;
}

Expand Down
Loading