共用方式為


ServiceBusReceiver.RenewMessageLockAsync Method

Definition

Renews the lock on the message. The lock will be renewed based on the setting specified on the queue.

public virtual System.Threading.Tasks.Task RenewMessageLockAsync (Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken = default);
abstract member RenewMessageLockAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RenewMessageLockAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function RenewMessageLockAsync (message As ServiceBusReceivedMessage, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

message
ServiceBusReceivedMessage

The ServiceBusReceivedMessage to renew the lock for.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

Exceptions

The lock for the message has expired or the message has already been completed. The Reason will be set to MessageLockLost in this case.

Remarks

When a message is received in PeekLock mode, the message is locked on the server for this receiver instance for a duration as specified during the Queue/Subscription creation (LockDuration). If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, it resets the time the message is locked by the LockDuration set on the Entity.

Applies to