v2 Azure Function with Service Bus trigger not firing

走远了吗. 提交于 2020-12-10 15:56:30

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/53302071/v2-azure-function-with-service-bus-trigger-not-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!