【问题标题】:Azure Functions V4 NET 6 Service Bus Trigger not firedAzure Functions V4 NET 6 服务总线触发器未触发
【发布时间】:2022-06-10 23:01:40
【问题描述】:

我刚刚将 Azure Functions 升级到 v4。我有一个服务总线队列触发器来处理队列的消息。
在我进行升级后,它不再被解雇,我不明白为什么以及如何调查。
代码没有从一个版本更改为另一个版本,我找不到有关此主题的任何重大更改。
该函数的日志没有显示任何错误或执行,并且消息被卡在队列中而没有其他信息。

这是我的触发器:

public class IncomingQueueTrigger
{
    private string _body;
    private HttpResponseMessage response;
    private SignalErrorQueueItem _errorObj;
    private readonly short _maxTriesCount = 2;
    private readonly HttpClient _client;

    public IncomingQueueTrigger(IHttpClientFactory httpClientFactory)
    {
        _client = httpClientFactory.CreateClient();
    }

    [FunctionName("IncomingQueueTrigger")]
    public async Task Run([ServiceBusTrigger("%my_queue_name%", Connection = "my_connection_string")] ServiceBusReceivedMessage myQueueItem, string label, ServiceBusReceiver messageReceiver)
    {
        // my code
    }
}

【问题讨论】:

    标签: azure azure-functions azureservicebus .net-6.0 azure-servicebus-queues


    【解决方案1】:

    我建议您查看Azure Functions Migration Document from 3.x to 4.x 以升级您的函数应用的运行时版本。

    此外,有关迁移 .NET Core 3.1 to 6.0 - document 时代码更改以及迁移运行时版本时如何在 Azure Functions 中更新包引用的信息。

    如果不能在本地运行,请调试函数代码并检查,或者如果它在本地运行但不能在 Azure 中运行,请执行 remote debugging 并在 Azure Function App Portal 中检查此窗口:

    如果问题仍然存在,请通过邮件 (AzCommunity@Microsoft.com) 联系 Azure 支持,提供问题描述、结果/错误屏幕截图和您遵循的故障排除步骤。

    【讨论】:

    • 我不知道我可以在本地运行这些函数。我一直使用远程调试,但是自从我开始使用 DevOps Pipeline 发布功能后,我就无法再进行远程调试了。有了这个,我发现了问题。谢谢
    【解决方案2】:

    在本地执行函数我得到了这个错误: Microsoft.Azure.WebJobs.Host: Error indexing method 'IncomingQueueTrigger'. Microsoft.Azure.WebJobs.Host: Can't bind parameter 'messageReceiver' to type 'Azure.Messaging.ServiceBus.ServiceBusReceiver'.
    在谷歌上搜索我发现this 在其中我了解到通过函数更新我还必须更新消息接收器的类型:

    ServiceBusReceiver => ServiceBusMessageActions

    现在一切都恢复正常了。

    感谢 HariKrishnaRajoli-MT 建议我尝试在本地运行这些函数。

    【讨论】:

      猜你喜欢
      • 2021-08-14
      • 1970-01-01
      • 2021-09-28
      • 2023-02-14
      • 1970-01-01
      • 2019-05-01
      • 2022-01-19
      • 2018-10-26
      • 2021-10-21
      相关资源
      最近更新 更多