后置任务定义
存在这种场景:同步请求返回,异步线程处理逻辑,将结果回调上游。
对于这种场景进行了后置任务抽象,现有后置任务定义:
HTTP_TASK
:http
请求任务
HTTP_TASK 定义
支持类型:
GET Request Param
类型:请求参数的Get
请求POST FormData
类型:form
表单数据的Post
请求POST JSON
类型:请求体为json
格式的Post
请求
格式:
json
{
"type": "HTTP_TASK",
"content": {
"url": "url",
"payloadType": "application/json | application/x-www-form-urlencoded",
"payload": "payload",
"method": "GET|POST"
}
}
type
:HTTP_TASK
url
:请求的url
payloadType
:请求体的类型,application/json
|application/x-www-form-urlencoded
。payload
:请求体内容,使用freemarker
模板引擎,支持freemarker
语法标签,model
赋值见变量。method
:请求方法,GET
|POST
GET Request Param类型
举例:
json
{
"type": "HTTP_TASK",
"content": {
"url": "http://127.0.0.1:9090/hello1",
"payloadType": "application/json",
"payload": "age=${p0.name}&name=${name}",
"method": "GET"
}
}
POST FormData类型
举例:
json
{
"type": "HTTP_TASK",
"content": {
"url": "http://localhost:9090/hello2",
"payloadType": "application/x-www-form-urlencoded",
"payload": "age=${p0.name}&name=${name}",
"method": "POST"
}
}
POST JSON类型
举例:
json
{
"type": "HTTP_TASK",
"content": {
"url": "http://127.0.0.1:9090/hello3",
"payloadType": "application/json",
"payload": "{\"age\":\"${p0.name}\",\"name\":\"${name!}\"}",
"method": "POST"
}
}