c# - Microsoft.Azure.ServiceBus : The lock supplied is invalid. 锁定已过期,或者消息已从队列中删除

标签 c# azure-functions azureservicebus

我有一个服务总线主题触发函数,只要将某些数据推送到主题,该函数就会被触发。

函数看起来像这样:

[FunctionName("funcGetServiceBusEntities")]
public async Task Run([ServiceBusTrigger("sbtopic", "sbsub", Connection = "ServiceBusConnectionString")]Message message, MessageReceiver messageReceiver, [DurableClient] IDurableOrchestrationClient starter, ILogger log)
{  
   // perform processing on the data

   //...

   //...

   // Complete since we don't want to process the message again
   await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

   //...
}

我不确定为什么会出现此错误:

Microsoft.Azure.ServiceBus: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. Reference:ab88d42f-5fed-4392-983a-921cc6eab776, TrackingId:7664c851-9f29-4b4f-a334-4038e0921810_B11, SystemTracker:sb-dev:Topic:sbtopic|sbsub, Timestamp:2020-03-31T12:09:32.

CompleteAsync 的实现有错吗?

最佳答案

这就是你现在面临的情况:

enter image description here

请注意,触发后消息将被删除。所以你不需要标记它,也不用担心再次处理消息。它已被删除。

关于c# - Microsoft.Azure.ServiceBus : The lock supplied is invalid. 锁定已过期,或者消息已从队列中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60950664/

相关文章:

c# - 如何将日期时间转换为两倍?

python - Azure函数错误: Error "SyntaxError: Unexpected token S in JSON at position 0" occurred while parsing the response body - Service Unavailable

.net - 我应该将哪个 .NET Azure 服务总线库用于队列?

azure - 服务总线 MessageSession 已接受,但接收返回 null

c# - 提供的锁无效。锁已过期,或者消息已从队列中删除

c# - 将项目绑定(bind)到 ListBox 多列

c# - 将 Owin/Katana 与 ASP.NET Core(实际用例)一起使用是否仍然相关?

c# - 如果向后兼容性不是问题,哪些 C# 功能将被删除?

azure - 如何通知新的 Azure AD B2C 用户注册或登录使用 azure 函数 HTTP 触发器注册的应用程序?

python - VS Code Azure 部署 Python Http 触发器功能失败 - 找不到 GLIB_2.27