ServiceBusReceiver.DeleteMessagesAsync 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.
Deletes up to messageCount
messages from the entity. The actual number
of deleted messages may be less if there are fewer eligible messages in the entity.
public virtual System.Threading.Tasks.Task<int> DeleteMessagesAsync (int messageCount, DateTimeOffset? beforeEnqueueTime = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteMessagesAsync : int * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
override this.DeleteMessagesAsync : int * Nullable<DateTimeOffset> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
Public Overridable Function DeleteMessagesAsync (messageCount As Integer, Optional beforeEnqueueTime As Nullable(Of DateTimeOffset) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)
Parameters
- messageCount
- Int32
The desired number of messages to delete. This value is limited by the service and governed Service Bus quotas. The service may delete fewer messages than this limit.
- beforeEnqueueTime
- Nullable<DateTimeOffset>
An optional DateTimeOffset, in UTC, representing the cutoff time for deletion. Only messages that were enqueued before this time will be deleted. If not specified, UtcNow will be assumed.
- cancellationToken
- CancellationToken
An optional CancellationToken instance to signal the request to cancel the operation.
Returns
The number of messages that were deleted.
Exceptions
Occurs when the messageCount
is less than 1 or exceeds the maximum allowed, as determined by the Service Bus service.
For more information on service limits, see https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas#messaging-quotas.
Remarks
If the lock for a message is held by a receiver, it will be respected and the message will not be deleted.
Applies to
Azure SDK for .NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기