gpt4 book ai didi

.net - Azure服务总线: How to Renew Lock?

转载 作者:行者123 更新时间:2023-12-02 16:30:27 27 4
gpt4 key购买 nike

如何更新接收队列消息处理程序上的锁?在事件处理程序上,测试消息没有更新锁定属性。

Message testMessage;

enter image description here

https://learn.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.brokeredmessage.renewlock?view=azure-dotnet

最佳答案

目前,建议使用 Azure.Messaging.ServiceBus NuGet 包,因为 Microsoft.Azure.ServiceBus 已过时。以下是自动续订处理消息的示例代码:

var client = new ServiceBusClient(connectionString);
var processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions
{
MaxAutoLockRenewalDuration = TimeSpan.FromHours(100),
});
processor.ProcessMessageAsync += async arg =>
{
//process your message
await Task.Delay(Timeout.Infinite);
};
processor.ProcessErrorAsync += async arg =>
{
//process errors
};

关于.net - Azure服务总线: How to Renew Lock?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63585687/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com