ServiceBusReceiver.PeekMessagesAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Fetches a list of active messages without changing the state of the receiver or the message source.
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))
Parameters
- maxMessages
- Int32
The maximum number of messages that will be fetched.
An optional sequence number from where to peek the message. This corresponds to the SequenceNumber.
- cancellationToken
- CancellationToken
An optional CancellationToken instance to signal the request to cancel the operation.
Returns
An IReadOnlyList<T> of messages that were peeked.
Remarks
Unlike a received message, a peeked message will not have a lock token associated with it, and hence it cannot be Completed/Abandoned/Deferred/Deadlettered/Renewed. Also, unlike ReceiveMessageAsync(Nullable<TimeSpan>, CancellationToken), this method will fetch even Deferred messages (but not Deadlettered messages).
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應