Skip to content

Commit c618c9c

Browse files
author
Travis Nickels
authored
Add documentation for LostLockException avoidance (#6828)
1 parent 6a6dd12 commit c618c9c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

transports/azure-service-bus/configuration.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ snippet: custom-prefetch-count
4848

4949
To disable prefetching, prefetch count should be set to zero.
5050

51+
> [!NOTE]
52+
> The lock duration for all prefetched messages starts as soon as they are fetched. To avoid `LockLostException`, ensure the lock-renewal duration is longer than the total time it takes to process all prefetched messages (i.e., message handler execution time multiplied by the prefetch count).
53+
5154
## Lock-renewal
5255

53-
For all supported transport transaction modes (except `TransportTransactionMode.None`), the transport uses a peek-lock mechanism to ensure a single instance of an endpoint can process a message. The default lock duration is specified during the entity creation. By default, the transport uses the SDK's default maximum auto lock renewal duration of 5 minutes.
56+
For all supported transport transaction modes (except `TransportTransactionMode.None`), the transport utilizes a peek-lock mechanism to ensure that only one instance of an endpoint can process a message. The default lock duration is set during entity creation. By default, the transport uses the SDK's default maximum auto lock renewal duration of 5 minutes.
57+
58+
To ensure smooth processing, it is recommended to configuring the `MaxAutoLockRenewalDuration` property to be greater than the longest running handler for the endpoint. This helps avoid `LockLostException` and ensures the message is properly handled by [the recoverability process](/nservicebus/recoverability/).
5459

5560
partial: lockrenewal
5661

0 commit comments

Comments
 (0)