在 Azure 数据工厂中执行等待活动Execute wait activity in Azure Data Factory

在管道中使用等待活动时,管道将等待一段指定的时间,然后继续执行后续活动。When you use a Wait activity in a pipeline, the pipeline waits for the specified period of time before continuing with execution of subsequent activities.

适用于:是 Azure 数据工厂是 Azure Synapse Analytics(预览版)APPLIES TO: yesAzure Data Factory yesAzure Synapse Analytics (Preview)

语法Syntax

{
    "name": "MyWaitActivity",
    "type": "Wait",
    "typeProperties": {
        "waitTimeInSeconds": 1
    }
}

Type 属性Type properties

属性Property 说明Description 允许的值Allowed values 必须Required
namename Wait 活动的名称。Name of the Wait activity. StringString Yes
typetype 必须被设置为 WaitMust be set to Wait. StringString Yes
waitTimeInSecondswaitTimeInSeconds 管道在继续进行处理前所等待的秒数。The number of seconds that the pipeline waits before continuing with the processing. IntegerInteger Yes

示例Example

备注

本部分提供运行管道的 JSON 定义和示例 PowerShell 命令。This section provides JSON definitions and sample PowerShell commands to run the pipeline. 有关使用 Azure PowerShell 和 JSON 定义创建数据工厂管道的分步说明演练,请参阅教程:使用 Azure PowerShell 创建数据工厂For a walkthrough with step-by-step instructions to create a Data Factory pipeline by using Azure PowerShell and JSON definitions, see tutorial: create a data factory by using Azure PowerShell.

等待活动的管道Pipeline with Wait activity

在此示例中,管道包含两个活动:UntilWaitIn this example, the pipeline has two activities: Until and Wait. 等待活动被配置为等待 1 秒。The Wait activity is configured to wait for one second. 管道循环运行 Web 活动,在每次运行之间等待 1 秒。The pipeline runs the Web activity in a loop with one second waiting time between each run.

{
    "name": "DoUntilPipeline",
    "properties": {
        "activities": [
            {
                "type": "Until",
                "typeProperties": {
                    "expression": {
                        "value": "@equals('Failed', coalesce(body('MyUnauthenticatedActivity')?.status, actions('MyUnauthenticatedActivity')?.status, 'null'))",
                        "type": "Expression"
                    },
                    "timeout": "00:00:01",
                    "activities": [
                        {
                            "name": "MyUnauthenticatedActivity",
                            "type": "WebActivity",
                            "typeProperties": {
                                "method": "get",
                                "url": "https://www.fake.com/",
                                "headers": {
                                    "Content-Type": "application/json"
                                }
                            },
                            "dependsOn": [
                                {
                                    "activity": "MyWaitActivity",
                                    "dependencyConditions": [ "Succeeded" ]
                                }
                            ]
                        },
                        {
                            "type": "Wait",
                            "typeProperties": {
                                "waitTimeInSeconds": 1
                            },
                            "name": "MyWaitActivity"
                        }
                    ]
                },
                "name": "MyUntilActivity"
            }
        ]
    }
}

后续步骤Next steps

查看数据工厂支持的其他控制流活动:See other control flow activities supported by Data Factory: