功能说明
数据万象支持自定义设置回调 URL,在工作流开启状态下,每执行一个实例后,系统会向该 URL 发送 HTTP POST 请求,请求体中包含通知内容。您可通过配置的回调地址及时了解工作流实例处理的进展和状态,以便进行其他业务操作。
回调内容
工作流开始或结束后,系统会向您设置的回调地址发送回调内容,包含完整节点数据的内容展示如下:
<EventName>WorkflowFinish</EventName><WorkflowExecution><RunId>i5f17a1fb400411ee88345254008e464b</RunId><BucketId>test-1234567890</BucketId><Object>car.mp4</Object><CosHeaders><Key>Content-Type</Key><Value>video/mp4</Value></CosHeaders><WorkflowId>w4699c83bde714bfd8d7f5dbd9b680f79</WorkflowId><WorkflowName>test</WorkflowName><CreateTime>2023-08-21 17:23:21+0800</CreateTime><State>Success</State><Tasks><Type>SmartCover</Type><CreateTime>2023-08-21 17:24:54+0800</CreateTime><EndTime>2023-08-21 17:25:10+0800</EndTime><State>Success</State><JobId>j9679e59e400411eebd82718e65e03ae1</JobId><Name>SmartCover_1659689887115</Name><ResultInfo><ObjectCount>1</ObjectCount><ObjectInfo><ObjectName>/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg</ObjectName><ObjectUrl>https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg</ObjectUrl></ObjectInfo></ResultInfo></Tasks><Tasks><Type>Transcode</Type><CreateTime>2023-08-21 17:23:22+0800</CreateTime><EndTime>2023-08-21 17:24:54+0800</EndTime><State>Success</State><JobId>j5f3e43d6400411eeae8e85430d2a07f5</JobId><Name>Transcode_1655896067644</Name><TemplateId>t09f9da59ed3c44ecd8ea1778e5ce5669c</TemplateId><TemplateName>HLS-265-FHD</TemplateName><ResultInfo><ObjectCount>1</ObjectCount><ObjectInfo><ObjectName>car.mp4.m3u8</ObjectName><ObjectUrl>https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4.m3u8</ObjectUrl></ObjectInfo></ResultInfo></Tasks></WorkflowExecution>
具体的数据内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Response | 无 | 保存结果的容器 | Container |
Container 节点 Response 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
EventName | Response | 固定值,为 WorkflowFinish 或 WorkflowStart | String |
WorkflowExecution | Response | 工作流的详细信息 | Container |
Container 节点 WorkflowExecution 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
WorkflowId | Response.WorkflowExecution | 工作流 ID | String |
WorkflowName | Response.WorkflowExecution | 工作流的名称 | String |
RunId | Response.WorkflowExecution | 工作流实例的 ID | String |
State | Response.WorkflowExecution | 实例的状态,值为 Success、Failed 其中一个。Tasks 存在一个 Failed,则此实例视为 Failed | String |
BucketId | Response.WorkflowExecution | 被处理文件所属的存储桶 | String |
Object | Response.WorkflowExecution | 该实例处理的文件名 | String |
CreateTime | Response.WorkflowExecution | 实例的创建时间 | String |
CosHeaders | Response.WorkflowExecution | 该 Object 上传时设定的自定义 Header 列表,没有设置时无此内容 | Container 数组 |
Tasks | Response.WorkflowExecution | 任务信息列表 | Container 数组 |
Container 节点 CosHeaders 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Key | Response.WorkflowExecution.CosHeaders | 自定义 Header 的名称 | String |
Value | Response.WorkflowExecution.CosHeaders | 自定义 Header 的值 | String |
Container 节点 Tasks 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Type | Response.WorkflowExecution.Tasks | 任务类型 | String |
CreateTime | Response.WorkflowExecution.Tasks | 任务的创建时间 | String |
EndTime | Response.WorkflowExecution.Tasks | 任务的完成时间 | String |
State | Response.WorkflowExecution.Tasks | 任务状态 Submitted:已提交,待执行 Running:执行中 Success:执行成功 Failed:执行失败 Pause:任务暂停,当暂停队列时,待执行的任务会变为暂停状态 Cancel:任务被取消执行 | String |
JobId | Response.WorkflowExecution.Tasks | 任务的 ID | String |
Name | Response.WorkflowExecution.Tasks | 任务在工作流中的节点名称 | String |
TemplateId | Response.WorkflowExecution.Tasks | 任务使用的模板 ID | String |
TemplateName | Response.WorkflowExecution.Tasks | 任务使用的模板名称 | String |
ResultInfo | Response.WorkflowExecution.Tasks | 任务结果详情 | Container |
Container 节点 ResultInfo 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
ObjectCount | Response.WorkflowExecution.Tasks.ResultInfo | 输出对象详情数组大小 | Int |
ObjectInfo | Response.WorkflowExecution.Tasks.ResultInfo | 输出对象详情 | Container 数组 |
SpriteObjectInfoCount | Response.WorkflowExecution.Tasks.ResultInfo | 雪碧图对象详情数组大小 | Int |
SpriteObjectInfo | Response.WorkflowExecution.Tasks.ResultInfo | 雪碧图对象详情 | Container 数组 |
Container 节点 SpriteObjectInfo 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
ObjectName | Response.WorkflowExecution.Tasks.ResultInfo.SpriteObjectInfo | 对象名 | String |
ObjectUrl | Response.WorkflowExecution.Tasks.ResultInfo.SpriteObjectInfo | 对象Url | String |
Container 节点 ObjectInfo 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
ObjectName | Response.WorkflowExecution.Tasks.ResultInfo.ObjectInfo | 对象名 | String |
ObjectUrl | Response.WorkflowExecution.Tasks.ResultInfo.ObjectInfo | 对象Url | String |
实际案例
案例一:XML
<EventName>WorkflowFinish</EventName><WorkflowExecution><RunId>i5f17a1fb400411ee88345254008e464b</RunId><BucketId>test-1234567890</BucketId><Object>car.mp4</Object><CosHeaders><Key>Content-Type</Key><Value>video/mp4</Value></CosHeaders><WorkflowId>w4699c83bde714bfd8d7f5dbd9b680f79</WorkflowId><WorkflowName>test</WorkflowName><CreateTime>2023-08-21 17:23:21+0800</CreateTime><State>Success</State><Tasks><Type>SmartCover</Type><CreateTime>2023-08-21 17:24:54+0800</CreateTime><EndTime>2023-08-21 17:25:10+0800</EndTime><State>Success</State><JobId>j9679e59e400411eebd82718e65e03ae1</JobId><Name>SmartCover_1659689887115</Name><ResultInfo><ObjectCount>1</ObjectCount><ObjectInfo><ObjectName>/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg</ObjectName><ObjectUrl>https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg</ObjectUrl></ObjectInfo></ResultInfo></Tasks><Tasks><Type>Transcode</Type><CreateTime>2023-08-21 17:23:22+0800</CreateTime><EndTime>2023-08-21 17:24:54+0800</EndTime><State>Success</State><JobId>j5f3e43d6400411eeae8e85430d2a07f5</JobId><Name>Transcode_1655896067644</Name><TemplateId>t09f9da59ed3c44ecd8ea1778e5ce5669c</TemplateId><TemplateName>HLS-265-FHD</TemplateName><ResultInfo><ObjectCount>1</ObjectCount><ObjectInfo><ObjectName>car.mp4.m3u8</ObjectName><ObjectUrl>https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4.m3u8</ObjectUrl></ObjectInfo></ResultInfo></Tasks></WorkflowExecution>
案例二:JSON
{"EventName": "WorkflowFinish","WorkflowExecution": {"RunId": "i5f17a1fb400411ee88345254008e464b","BucketId": "test-1234567890","Object": "car.mp4","CosHeaders": [{"Key": "Content-Type","Value": "video/mp4"}],"WorkflowId": "w4699c83bde714bfd8d7f5dbd9b680f79","WorkflowName": "test","CreateTime": "2023-08-21 17:23:21+0800","State": "Success","Tasks": [{"Type": "SmartCover","CreateTime": "2023-08-21 17:24:54+0800","EndTime": "2023-08-21 17:25:10+0800","State": "Success","JobId": "j9679e59e400411eebd82718e65e03ae1","Name": "SmartCover_1659689887115","SmartCover": {"format": "jpg","count": "1"},"ResultInfo": {"ObjectCount": 1,"ObjectInfo": [{"ObjectName": "/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg","ObjectUrl": "https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4_i5f17a1fb400411ee88345254008e464b.jpg"}]}}, {"Type": "Transcode","CreateTime": "2023-08-21 17:23:22+0800","EndTime": "2023-08-21 17:24:54+0800","State": "Success","JobId": "j5f3e43d6400411eeae8e85430d2a07f5","Name": "Transcode_1655896067644","TemplateId": "t09f9da59ed3c44ecd8ea1778e5ce5669c","TemplateName": "HLS-265-FHD","ResultInfo": {"ObjectCount": 1,"ObjectInfo": [{"ObjectName": "car.mp4.m3u8","ObjectUrl": "https://test-1234567890.cos.ap-chongqing.myqcloud.com/car.mp4.m3u8"}]}}]}}