Webhook 活动在 ADF V2 中永远运行 [英] Webhook Activity runs forever in ADF V2

查看:52
本文介绍了Webhook 活动在 ADF V2 中永远运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过我在 Power Shell 中编写代码的 Runbook 处理我的多维数据集.我想从 ADF 的 webhook 活动中调用此 Runbook.但是此活动一直运行到超时并且无法完成,但是它正在处理多维数据集通过触发运行手册成功.我是否必须编写更多代码才能使其在 ADF 中成功或失败.还是我的配置中缺少其他内容.

I want to process my cube through runbook where I have written the code in Power Shell.I want to call this runbook from the webhook activity from ADF.But this activity is running until the timeout and could not complete however its processing the cube successfully by triggering the run book. Do I have to write some more code in order to make it successful or fail in ADF. or am I missing something else in my configuration.

推荐答案

如果您希望 ADF 等到 Runbook 完成,那么 Webhook 活动(就像您正在做的那样)是正确的.但是您的 Runbook 需要使用 Azure 自动化 webhook 文档中的 $webhookData 参数.并且 Runbook 需要对 ADF 回调 API 进行 Web 回调,让它知道它已完成.

If you want for ADF to wait until the runbook completes than a Webhook activity (like you are doing) is right. But your runbook needs to take in the callbackUri parameter using the $webhookData parameter in the Azure Automation webhook documentation. And the runbook needs to make a Web call back to the ADF callback API to let it know it’s done.

另一方面,如果您不希望 ADF 等待或知道 Runbook 是否失败,则使用 Web Activity 而不是 Webhook Activity.

On the other hand if you don’t want ADF to wait or know whether the runbook failed then use a Web Activity rather than a Webhook activity.

如果继续使用 ADF Webhook,则需要更改 Azure 自动化运行手册以包含以下参数和解析:

If you proceed with an ADF webhook, then you will need to change your Azure Automation runbook to include the following parameter and parsing:

param(
    [object] $WebhookData
)

$ErrorActionPreference = "Stop";

try
{
    #parse the webhook parameters
    if (-Not $WebhookData.RequestBody)
    {
        #we're testing in the test pane
        $WebhookData = ConvertFrom-Json -InputObject $WebhookData
    }
    $WebhookBody = ConvertFrom-Json -InputObject $WebhookData.RequestBody
    [string] $callbackUri = $WebhookBody.callbackUri

    #complete your typical runbook work here...

    if ($callbackUri)
    {
        $null = Invoke-WebRequest -Method Post -Uri $callbackUri -ContentType "application/json" -Body '{"StatusCode": "200"}' -UseBasicParsing
    }

}
catch 
{
    if ($callbackUri)
    {
        $null = Invoke-WebRequest -Method Post -Uri $callbackUri -ContentType "application/json" -Body '{"StatusCode": "500", "Error": {"ErrorCode":100,"Message","$_"}}' -UseBasicParsing
    }
    "Failed: $_"
    throw $_
}

这应该可以解决您认为 Runbook 永远运行的 ADF 问题.

That should solve your problem with ADF thinking the runbook runs forever.

这篇关于Webhook 活动在 ADF V2 中永远运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆