Microsoft Azure 服务总线消息已完成

Microsoft Azure Service Bus Message completed

在 .NET Framework 中 Microsoft.ServiceBus.Messaging 有一个 class 用于从服务总线 BrokeredMessage 接收消息。但是,在 .NET Standard 2.0 中,为了从服务总线接收消息,使用了来自 Microsoft.Azure.ServiceBus.Core 的 class 消息。

BrokeredMessage 有一个方法,CompleteAsync(),用于完成消息的接收操作,并指示消息应该被标记为已处理和删除。我找不到 Message class 的方法来做同样的事情。你们知道任何解决方案可以将消息标记为已处理和已删除消息 class?

要使用 Microsoft.Azure.ServiceBus.Core 完成队列中的消息,QueueClient 中有一个方法 CompleteAsync 可用,将通过该方法接收消息。

消息的锁定令牌应作为 CompleteAsync 方法的参数传递。

示例:queueClient.CompleteAsync(message.SystemProperties.LockToken)