你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ServiceBusReceiver.PeekMessagesAsync 方法

定义

public virtual System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Azure.Messaging.ServiceBus.ServiceBusReceivedMessage>> PeekMessagesAsync (int maxMessages, long? fromSequenceNumber = default, System.Threading.CancellationToken cancellationToken = default);
abstract member PeekMessagesAsync : int * Nullable<int64> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Azure.Messaging.ServiceBus.ServiceBusReceivedMessage>>
override this.PeekMessagesAsync : int * Nullable<int64> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Azure.Messaging.ServiceBus.ServiceBusReceivedMessage>>
Public Overridable Function PeekMessagesAsync (maxMessages As Integer, Optional fromSequenceNumber As Nullable(Of Long) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IReadOnlyList(Of ServiceBusReceivedMessage))

参数

maxMessages
Int32

要提取的最大消息数。

fromSequenceNumber
Nullable<Int64>

从中查看消息的可选序列号。 这对应于 SequenceNumber

cancellationToken
CancellationToken

一个可选 CancellationToken 实例,用于向请求发出取消操作的信号。

返回

一个 IReadOnlyList<T> 被速览的消息。

注解

与收到的消息不同,速览邮件不会具有与之关联的锁定令牌,因此它不能为 Completed/Abandoned/Deferred/Deadlettered/Renewed。 此外,与 不同 ReceiveMessageAsync(Nullable<TimeSpan>, CancellationToken),此方法甚至会提取 (但不会) 死消息的延迟消息。

适用于