功能说明
数据万象支持自定义设置回调 URL,在任务完成后,系统向该 URL 发送 HTTP POST 请求,请求体中包含通知内容。您可通过配置的回调地址及时了解任务处理的进展和状态,以便进行其他业务操作。
回调内容
任务完成后,系统会向您设置的回调地址发送回调内容,包含完整节点数据的内容展示如下:
TaskFinish
Success 2022-06-30T15:29:42+0800 2022-06-30T15:29:48+0800 test-123456789 input/demo.mp4 ap-chongqing j682b9662f84611ecb8546d80f2baf56f 97624.424000 0.870000 CompuServe Graphics Interchange Format (GIF) gif 0 1 10616656 0.000000 14.666667 CompuServe GIF (Graphics Interchange Format) gif 0x0000 [0][0][0][0] 1/100 unknown unknown unknown 0.870000 15.083333 0 2258 0 -99 7 bgra 1 0.000000 0.000000 1/100 1280 test-123456789 3df1f845d2ffd20a525a93ec40014d90 output/animation.gif output/animation.gif ap-chongqing test-123456789 output/animation.${ext} ap-chongqing t1f16e1dfbdc994105b31292d45710642a template_name1512456 This is my Animation job. 0 p2242ab62c7c94486915508540933a2c6 2022-06-30T15:29:43+0800 Success Animation
具体的数据内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Response | 无 | 保存结果的容器 | Container |
Container 节点 Response 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
EventName | Response | 固定值,为 TaskFinish | String |
JobsDetail | Response | 同提交动图任务接口中的 Response.JobsDetail | Container 数组 |
如果任务是通过工作流触发的,Response.JobsDetail.Input 还会包含 CosHeaders 节点,类型为 Container 数组。Container 节点 CosHeaders 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Key | Response.JobsDetail.Input.CosHeaders | 自定义 Header 的名称 | String |
Value | Response.JobsDetail.Input.CosHeaders | 自定义 Header 的值 | String |
如果任务是通过工作流触发的,Response.JobsDetail 还会包含 Workflow 节点,类型为 Container。Container 节点 Workflow 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
RunId | Response.Workflow | 工作流实例 ID | String |
WorkflowId | Response.Workflow | 工作流 ID | String |
WorkflowName | Response.Workflow | 工作流名称 | String |
Name | Response.Workflow | 工作流节点名称 | String |
实际案例
案例 1:通过任务接口触发的任务回调
TaskFinish
Success 2022-06-30T15:29:42+0800 2022-06-30T15:29:48+0800 test-123456789 input/demo.mp4 ap-chongqing j682b9662f84611ecb8546d80f2baf56f 97624.424000 0.870000 CompuServe Graphics Interchange Format (GIF) gif 0 1 10616656 0.000000 14.666667 CompuServe GIF (Graphics Interchange Format) gif 0x0000 [0][0][0][0] 1/100 unknown unknown unknown 0.870000 15.083333 0 2258 0 -99 7 bgra 1 0.000000 0.000000 1/100 1280 test-123456789 3df1f845d2ffd20a525a93ec40014d90 output/animation.gif output/animation.gif ap-chongqing test-123456789 output/animation.${ext} ap-chongqing t1f16e1dfbdc994105b31292d45710642a template_name1512456 This is my Animation job. 0 p2242ab62c7c94486915508540933a2c6 2022-06-30T15:29:43+0800 Success Animation
案例 2:通过工作流触发的任务回调
TaskFinish
Success 2022-06-30T15:29:42+0800 2022-06-30T15:29:48+0800 test-123456789 input/demo.mp4 ap-chongqing Content-Type video/mp4 x-cos-request-id NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5 EventName cos:ObjectCreated:Put Size 1424687 j682b9662f84611ecb8546d80f2baf56f 97624.424000 0.870000 CompuServe Graphics Interchange Format (GIF) gif 0 1 10616656 0.000000 14.666667 CompuServe GIF (Graphics Interchange Format) gif 0x0000 [0][0][0][0] 1/100 unknown unknown unknown 0.870000 15.083333 0 2258 0 -99 7 bgra 1 0.000000 0.000000 1/100 1280 test-123456789 3df1f845d2ffd20a525a93ec40014d90 output/animation.gif output/animation.gif ap-chongqing test-123456789 output/animation.${ext} ap-chongqing t1f16e1dfbdc994105b31292d45710642a template_name1512456 This is my Animation job. 0 p2242ab62c7c94486915508540933a2c6 2022-06-30T15:29:43+0800 Success Animation Animation_1581665960537 ic90edd59f84f11ec9d4f525400a3c59f web6ac56c1ef54dbfa44d7f4103203be9 workflow-test
案例 3:通过工作流触发的任务回调, 格式为 JSON
{ "EventName": "TaskFinish", "JobsDetail": [{ "Code": "Success", "CreationTime": "2022-06-30T15:29:42+0800", "EndTime": "2022-06-30T15:29:48+0800", "Input": { "BucketId": "test-123456789", "Object": "input/demo.mp4", "Region": "ap-chongqing", "CosHeaders": [{ "Key": "Content-Type", "Value": "video/mp4" }, { "Key": "x-cos-request-id", "Value": "NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5" }, { "Key": "EventName", "Value": "cos:ObjectCreated:Put" }, { "Key": "Size", "Value": "1424687" } ] }, "JobId": "j682b9662f84611ecb8546d80f2baf56f", "Operation": { "MediaInfo": { "Format": { "Bitrate": "97624.424000", "Duration": "0.870000", "FormatLongName": "CompuServe Graphics Interchange Format (GIF)", "FormatName": "gif", "NumProgram": "0", "NumStream": "1", "Size": "10616656", "StartTime": "0.000000" }, "Stream": { "Video": { "AvgFps": "14.666667", "CodecLongName": "CompuServe GIF (Graphics Interchange Format)", "CodecName": "gif", "CodecTag": "0x0000", "CodecTagString": "[0][0][0][0]", "CodecTimeBase": "1/100", "ColorPrimaries": "unknown", "ColorRange": "unknown", "ColorTransfer": "unknown", "Duration": "0.870000", "Fps": "15.083333", "HasBFrame": "0", "Height": "2258", "Index": "0", "Level": "-99", "NumFrames": "7", "PixFormat": "bgra", "RefFrames": "1", "Rotation": "0.000000", "StartTime": "0.000000", "Timebase": "1/100", "Width": "1280" } } }, "MediaResult": { "OutputFile": { "Bucket": "test-123456789", "Md5Info": [{ "Md5": "3df1f845d2ffd20a525a93ec40014d90", "ObjectName": "output/animation.gif" }], "ObjectName": ["output/animation.gif"], "Region": "ap-chongqing" } }, "Output": { "Bucket": "test-123456789", "Object": "output/animation.${ext}", "Region": "ap-chongqing" }, "TemplateId": "t1f16e1dfbdc994105b31292d45710642a", "TemplateName": "template_name1512456", "UserData": "This is my Animation job.", "JobLevel": 0 }, "QueueId": "p2242ab62c7c94486915508540933a2c6", "StartTime": "2022-06-30T15:29:43+0800", "State": "Success", "Tag": "Animation", "Workflow": { "Name": "Animation_1581665960537", "RunId": "ic90edd59f84f11ec9d4f525400a3c59f", "WorkflowId": "web6ac56c1ef54dbfa44d7f4103203be9", "WorkflowName": "workflow-test" } }]}
对象存储官网1折活动,限时活动,即将结束,速速收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利。同意关联立享优惠
转转请注明出处:https://www.yunxiaoer.com/145179.html