This topic describes how to execute a flow in Serverless Workflow on a specified schedule to call functions deployed in Function Compute.

Execution process

The process of a specified schedule for a flow consists of the following steps:

  1. In Serverless Workflow, define a task step that calls a function in Function Compute.
  2. In Serverless Workflow, create a time-based schedule. Both the flow and the function in the flow are executed on the schedule.
8b0732b23943d746

Procedure

  1. Log on to the Serverless Workflow console.
  2. In the left-side navigation pane, choose Application Center > Create Application.
  3. On the Create Application page, click the Select Template tab. Select the Timer template and click Configure and Deploy.
    app_center_timer
  4. On the Configure and Deploy tab, configure the parameters, and then click Deploy.
    create_timer_app
    The following table describes the parameters.
    Parameter Description
    Application Name The name of the application, which must be unique in the same account.
    Note Your application is a custom Resource Orchestration Service (ROS) resource. You can log on to the ROS console to view the application.
    Cron The Cron expressions to execute the flow on a specified schedule. For more information, see Parameters for time-based schedules.
    Input The input of the flow that is executed on a specified schedule. The input must be in JSON format and its default value is null. For more information, see Input format.
    After the application is deployed, all the resources created by this application are displayed.de339104fa7aaff8
    • Role of the RAM user: AliyunFCInvocationAccessflowRole with the function call permission and flowRole with the flow permission.
    • Function Compute resources: service and the servicehello function.
    • Serverless Workflow resources: flow and time-based schedule (ALIYUN::FNF::Schedule).
  5. Log on to the Serverless Workflow console and check whether the flow you created is executed on the specified schedule.
    function_timed_execute_success

    The following code shows the definition of a flow that calls the hello function of Function Compute in the task step.

    version: v1
    type: flow
    steps:
      # task step to invoke FC function hello
      - type: task
        name: hello
        resourceArn: acs:fc:::services/service-CD946B9A9F36/functions/hello                   

    You can modify the definition of this flow to implement your business logic. For more information, see Modify flows.