服务总线中消息丢失锁定和连接处于非活动状态

发布于 2025-01-20 01:45:24 字数 864 浏览 2 评论 0 原文

我有以下 Azure 服务总线触发器功能代码:

[FunctionName("FunctionName")]
public async Task Run(ServiceBusTrigger("", Connection = "connectionString")] Message message, MessageReceiver messageReceiver, [DurableClient] IDurableOrchestrationClient starter)
{
    var person = JsonConvert.DeserializeObject<Person>(Encoding.UTF8.GetString(message.Body));
    await starter.StartNewAsync(nameof(OrchestratorFunction), person);
    await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);
}

运行此代码时,我看到以下 2 个错误:

< img src="https://i.sstatic.net/xeLe4.png" alt="在此处输入图像描述">

在此处输入图像描述

我缺少什么?

I have the following the Azure Service Bus Trigger Function code:

[FunctionName("FunctionName")]
public async Task Run(ServiceBusTrigger("", Connection = "connectionString")] Message message, MessageReceiver messageReceiver, [DurableClient] IDurableOrchestrationClient starter)
{
    var person = JsonConvert.DeserializeObject<Person>(Encoding.UTF8.GetString(message.Body));
    await starter.StartNewAsync(nameof(OrchestratorFunction), person);
    await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);
}

On running this, I see the following 2 errors:

enter image description here

AND

enter image description here

What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一直在等你来 2025-01-27 01:45:24

锁丢失异常表明当您调用“completeasync”时锁已经过期。这意味着接收方处理消息的时间比锁定持续时间长。
您可以尝试将锁定持续时间增加到最大 5 分钟,看看这些锁定丢失异常的频率是否减少或消失。

另一个异常只是表明服务因不活动而关闭,但这没有害处,接收者将在之后自动重新连接。

The lock lost exception indicates that when you call "completeasync" the lock is already expired. Which means that the receiver is taking longer to process the message than the lock duration.
You can try increasing the lock duration up to the maximum of 5 minutes to see if the frequency of those lock lost exceptions reduces or dissapears.

The other exception just indicates that the service closed due connection due to inactivity but this is harmless, and the receiver will reconnect automatically after that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文