带有服务总线触发器的 v2 Azure 函数未触发 [英] v2 Azure Function with Service Bus trigger not firing

查看:21
本文介绍了带有服务总线触发器的 v2 Azure 函数未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Azure Functions V2 与使用 C# Functions SDK 1.0.23 的服务总线触发器一起使用.我正在使用以下方法从 KeyVault 获取机密并在触发器的设置中使用它们:

  • 问题 #681
  • 有 3 种建议的方法来解决它,作为上述问题 #210 的一部分

    <块引用>

    为了在这些部署选项启用时同步触发器使用,打开 Azure 门户并单击刷新按钮,或创建一个对同步触发端点的 API 调用:https://github.com/davidebbo/AzureWebsitesSamples/blob/master/ARMTemplates/FunctionsWebDeploy.json#L90

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

    I am using Azure Functions V2 with a Service Bus trigger using 1.0.23 of the C# Functions SDK. I'm using the following approach to get secrets from KeyVault and use them within the settings of the triggers: How to map Azure Functions secrets from Key Vault automatically

    The function, especially when it has done nothing for a while, doesn't fire when there are messages on the subscription. If I then go to the portal and execute manually (yes, that particular execution is fired with a null message) it kicks it into life and picks up the other messages on the queue and processes them correctly.

    This obviously isn't ideally for our automated tests. Has anybody seen this, or know of anything that will help?

    Also, the Function App is running on a consumption plan.

    解决方案

    App Service Plan

    If you're using App Service plan then it's simple, just make use of Always on

    Consumption Plan

    If you're using Consumption plan, the issue could be that your triggers did not sync properly with the Azure Infrastructure (Central Listener). It could have happened due to the way you deployed/edited your trigger related settings as explained in issue #210 below.

    When you access the function directly from Portal, it might be forcing your function app to come alive, but as you can see that's only a workaround. Something similar is mentioned here

    Take a look at these issues:

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

      They also mention that it wakes up only on accessing it via the portal or calling a HTTP triggered function in the same app, which is similar to the behavior you are seeing.

    2. Issue #210

    3. Issue #681

    There are 3 suggested ways to resolve it, mentioned as part of Issue #210 above

    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

    这篇关于带有服务总线触发器的 v2 Azure 函数未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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