文档首页 > > 最佳实践> 构建视频处理业务应用> 编排功能程序

编排功能程序

分享
更新时间: 2019/04/18 GMT+08:00

创建工作流的代码请使用程序包中workflow-videoconvert.json,操作步骤如下。

  1. 登录函数工作流服务控制台,进入“工作流>工作流列表”界面,单击“创建工作流”,进入创建工作流界面。
  2. 输入工作流信息

    1. 填写名称,输入“workflow-serverless”
    2. 模板类型选择“自定义”

  3. 编排函数

    1. 单击“”,进入代码修改页,如图1所示。
      图1 图标
    2. 输入工作流代码信息,将workflow-videoconvert.json文件中如下代码输入代码框。
      {
       "states": {
        "gettype": {
         "start": true,
         "type": "OPERATION",
         "action-mode": "SEQUENTIAL",
         "actions": [
          {
           "action-name": "gettypeaction",
           "function": "urn:fss:cn-north-1:bb8695913bb74682b9ca82a8803b60d8:function:default:gettype",
           "invocation-mode": "SYNC"
          }
         ],
         "next-state": "checktype"
        },
        "checktype": {
         "type": "SWITCH",
         "choices": [
          {
           "path": "$.f",
           "value": "1",
           "next-state": "avi2mp4"
          },
          {
           "path": "$.f",
           "value": "2",
           "next-state": "flv2mp4"
          }
         ],
         "default": "avi2mp4"
        },
        "avi2mp4": {
         "type": "OPERATION",
         "action-mode": "SEQUENTIAL",
         "actions": [
          {
           "action-name": "convert-avi",
           "function": "urn:fss:cn-north-1:bb8695913bb74682b9ca82a8803b60d8:function:default:convertvideo",
           "invocation-mode": "SYNC",
           "results": [
            {
             "match": "MatchAny",
             "retry-interval": 1,
             "max-retry": 3,
             "next-state": "notifyuser"
            }
           ]
          }
         ],
         "next-state": "screenshot"
        },
        "flv2mp4": {
         "type": "OPERATION",
         "action-mode": "SEQUENTIAL",
         "actions": [
          {
           "action-name": "convert-flv",
           "function": "urn:fss:cn-north-1:bb8695913bb74682b9ca82a8803b60d8:function:default:convertvideo",
           "invocation-mode": "SYNC",
           "results": [
            {
             "match": "MatchAny",
             "retry-interval": 1,
             "max-retry": 3,
             "next-state": "screenshot"
            }
           ]
          }
         ],
         "next-state": "screenshot"
        },
        "notifyuser": {
         "type": "OPERATION",
         "action-mode": "SEQUENTIAL",
         "actions": [
          {
           "action-name": "notification",
           "function": "urn:fss:cn-north-1:bb8695913bb74682b9ca82a8803b60d8:function:default:notify_user",
           "invocation-mode": "SYNC"
          }
         ],
         "next-state": "end"
        },
        "screenshot": {
         "type": "OPERATION",
         "action-mode": "SEQUENTIAL",
         "actions": [
          {
           "action-name": "screenshot",
           "function": "urn:fss:cn-north-1:bb8695913bb74682b9ca82a8803b60d8:function:default:screenshot",
           "invocation-mode": "SYNC"
          }
         ],
         "next-state": "end"
        },
        "end": {
         "type": "END"
        }
       }
      }
    3. 编排函数,方法如下。

      在gettypeaction节点编排gettype函数,鼠标定位在函数URN位置,可以从函数列表中选择函数,如图2所示。

      图2 编排函数

      节点与编排函数对应关系如表1所示。

      表1 对应关系

      节点名称

      被编排函数名称

      gettypeaction

      gettype

      convert-avi

      convertvideo

      convert-flv

      convertvideo

      notification

      notifyuser

      screenshot

      screenshot

    4. 确认工作流信息无误后,单击“创建”,创建工作流。

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

跳转到云社区