FixDelayRetry 锁定函数

Jiale Xue - MSFT 37,946 信誉分 Microsoft 供应商
2024-03-13T08:53:04.0733333+00:00
   [FunctionName("FixedDelayRetryTest")]  
   [FixedDelayRetry(5, "00:01:00")]  
   public void Run(  
       [ServiceBusTrigger("Topic", "Subscription", Connection = "ServiceBusConnString")] string item,  
       ExecutionContext context,  
       ILogger log  
   )  
   {  
       log.LogInformation($"Function executed at: {DateTime.Now}");  
     
       throw new System.Exception("Error Happened!!");  
   }  

在测试 Azure 函数的机制(v3 - .NET Core 3.1)时,FixedDelayRetry

卡在像函数这样的场景中不会处理下一条消息,直到函数消耗所有剩余的重试并且该消息最终进入死信队列!

Note:此问题总结整理于:FixedDelayRetry locking up the Function

C#
C#
一种面向对象的类型安全的编程语言,它起源于 C 语言系列,包括对面向组件的编程的支持。
145 个问题
0 个注释 无注释
{count} 票

接受的答案
  1. Hui Liu-MSFT 44,471 信誉分 Microsoft 供应商
    2024-03-13T10:00:34.7033333+00:00

    You are seeing this behavior because you are throwing exception in the code. Please throw the exception in the catch block so that you dont encounter the retries.

    [FunctionName("FixedDelayRetryTest")]

    [FixedDelayRetry(5, "00:01:00")]

    public void Run(

    [ServiceBusTrigger("Topic", "Subscription", Connection = "ServiceBusConnString")] string item,

    ExecutionContext context,

    ILogger log

    )

    {

    try

    {

    log.LogInformation($"Function executed at: {DateTime.Now}");

    }

    catch

    {

    throw new System.Exception("Error Happened!!");

    }

    }

    如果答案有帮助,请点击“接受答案”并点赞。 注意:如果您想接收此线程的相关电子邮件通知,请按照我们文档中的步骤启用电子邮件通知。

    0 个注释 无注释

0 个其他答案

排序依据: 非常有帮助