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
Azure SDK for .NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기