gpt4 book ai didi

azure - v2 Azure Function with Service Bus 触发器未触发

转载 作者:行者123 更新时间:2023-12-04 11:31:21 26 4
gpt4 key购买 nike

我正在将 Azure Functions V2 与使用 C# Functions SDK 1.0.23 的服务总线触发器结合使用。我使用以下方法从 KeyVault 获取 secret 并在触发器的设置中使用它们:How to map Azure Functions secrets from Key Vault automatically

该函数,特别是当它有一段时间没有执行任何操作时,当订阅上有消息时不会触发。如果我然后转到门户并手动执行(是的,该特定执行是用空消息触发的),它将启动它并拾取队列中的其他消息并正确处理它们。

这显然不适合我们的自动化测试。有没有人见过这个,或者知道任何有帮助的事情?

此外,Function App 正在按消耗计划运行。

最佳答案

应用服务计划

如果您使用的是应用服务计划,那么很简单,只需使用 Always on

消费计划

如果您使用消耗计划,问题可能是您的触发器未与 Azure 基础结构(中央监听器)正确同步。发生这种情况的原因可能是您部署/编辑触发器相关设置的方式所致,如下面的问题 #210 中所述。

当您直接从 Portal 访问该函数时,它可能会强制您的函数应用程序启动,但正如您所看到的,这只是一种解决方法。提到了类似的事情here

看看这些问题:

  1. Service Bus Topic Trigger goes to sleep - Consumption Plan

    他们还提到,它仅在通过门户访问它或在同一应用程序中调用 HTTP 触发函数时才会唤醒,这与您所看到的行为类似。

  2. Issue #210 enter image description here

  3. Issue #681

有 3 种建议的方法来解决该问题,如上面问题 #210 的一部分所述

In order to synchronize triggers when these deployment options are used, open the Azure Portal and click the Refresh button, or make a API call to the sync triggers endpoint: https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ARMTemplates/FunctionsWebDeploy.json#L90

Powershell sample: https://github.com/davidebbo/AzureWebsitesSamples/blob/master/PowerShell/HelperFunctions.ps1#L360-L365

关于azure - v2 Azure Function with Service Bus 触发器未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53302071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com