conductor服务编排http任务安排

# 文档
http://wiki.ttxit.com/pages/viewpage.action?pageId=25919490
# 编排
1.定义任务:http://localhost:8080/api/metadata/taskdefs
[{
  "name": "user_task",
  "retryCount": 3,
  "timeoutSeconds": 1200,
  "inputKeys": [
    "type"
  ],
  "outputKeys": [
    "id",
    "name"
  ],
  "timeoutPolicy": "TIME_OUT_WF",
  "retryLogic": "FIXED",
  "retryDelaySeconds": 600,
  "responseTimeoutSeconds": 3600
},
{
  "name": "group_task",
  "retryCount": 3,
  "timeoutSeconds": 1200,
  "inputKeys": [
    "id",
    "name"
  ],
  "outputKeys": [
    "response",
    "result"
  ],
  "timeoutPolicy": "TIME_OUT_WF",
  "retryLogic": "FIXED",
  "retryDelaySeconds": 600,
  "responseTimeoutSeconds": 3600
}
]
name    任务类型    唯一
retryCount    任务标记为失败时尝试重试的次数    -
retryLogic    重试机制
timeoutSeconds    以毫秒为单位的时间,在此之后,如果在转换到IN_PROGRESS状态后未完成任务,则将任务标记为TIMED_OUT    如果设置为0,则不会超时
timeoutPolicy    任务的超时策略
responseTimeoutSeconds    如果大于0,则在此时间之后未更新状态时,将重新安排任务。当work轮询任务但由于错误/网络故障而无法完成时很有用。    -
outputKeys    任务输出的键集。用于记录任务的输出
2.定义工作流:http://localhost:8080/api/metadata/workflow
{
  "name": "user_and_group",
  "description": "Encodes a file and deploys to CDN",
  "version": 1,
  "tasks": [
    {
      "name": "user_task",
      "taskReferenceName": "user",
      "inputParameters": {
            "http_request": {
                "method": "POST",
                "uri": "http://localhost:8000/user/getUser",
                "body": {
                    "type": "${workflow.input.type}"
                }
            }
        },
      "type": "HTTP"
    },
    {
      "name": "group_task",
      "taskReferenceName": "group",
      "inputParameters": {
            "http_request": {
                "method": "POST",
                "uri": "http://localhost:8010/group/getGroup",
                "body": {
                    "id": "${user.output.response.body.id}",
                    "name": "${user.output.response.body.name}"
                }
            }
      },
      "type": "HTTP"
    }
  ],
  "outputParameters": {
    "response": "${group.output.response.body.response}",
    "result": "${group.output.response.body.result}"
  },
  "schemaVersion": 2
}
3.任务执行:http://localhost:8080/api/workflow/{workname}
在body中定义参数:
{
"type":"1"
}
4.根据上一步返回的id获取任务信息:http://localhost:8080/api/workflow/{workid}:
输出内容:
{
"output": {
    "response": [
      "1",
      "2",
      "3",
      "4"
    ],
    "result": "李四gaga"
  }
}

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值