1分钟后,Azure Data Factory WebHook失败

时间:2020-03-05 01:17:01

标签: azure-data-factory

我们有一些Azure函数可以调用耗时超过230秒(从ADF调用Azure函数的最大运行时间)的API终结点。我们发现的解决方法是使用Webhook活动并使用callBackUri。但是无论出于何种原因,webhook总是在00:01:01失败,并出现BadRequest错误:

BadRequestError:
BadRequestError

如果该功能在该分钟内完成,则回调正常运行并且运行正常。

WebHook的超时设置为10分钟(00:10:00),但是1分钟后它将引发BadRequest错误。 Azure函数继续在后台运行,并将成功完成其任务,但是我的管道现已断开,无法继续进行下一步。

我不能使用耐用的Azure函数,因为Python Azure Functions尚不支持。

2 个答案:

答案 0 :(得分:1)

经过一些进一步的调查,预计将出现1分钟超时错误。阅读文档后,对于长时间运行的呼叫,该活动希望在几分钟内响应202(已接受)。

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-webhook-activity#additional-notes

关于异步请求-应答模式(和示例C#代码)的详细信息在这里: https://docs.microsoft.com/en-us/azure/architecture/patterns/async-request-reply

答案 1 :(得分:0)

我通过使用-Timeout参数设法在Azure Function本身中使用了替代方法。此处的详细信息:Using Azure Data Factory's Web Hook Activity to invoke/poll Azure Powershell Function App times out after one minute

下面的示例运行代码:

$Body = @{
            callbackUri = $Request.Body.callBackUri;
        } | ConvertTo-Json
try{
    # This API will be responsible for issuing the call back after it has finished the long running process
    $output = Invoke-RestMethod -Method Post -Body $Body -Uri $funcapp2Url -ContentType 'application/json' -TimeoutSec 1
}
catch {
    Write-Output $_
}

# Return HTTP 202 immediately
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
    StatusCode = [HttpStatusCode]::Accepted
    Body = "Wait for callback"
}) -Clobber