Search code examples
nservicebusazureservicebus

Is there an equivalent to AutoRenewTimeout(TimeSpan) for ASB transport?


We are using the (non-legacy) Azure Service Bus transport. Is there an equivalent to AutoRenewTimeout(TimeSpan) that we can use? And if not (as the docs suggest) how does the transport handle long-running processes?


Solution

  • Is there an equivalent to AutoRenewTimeout(TimeSpan) that we can use?

    The short answer is "no". The legacy transport included the option of auto-renewing the lock which was not introduced in the new transport. The rationale for that was simply due to some issues with the functionality. First, it is not a guaranteed operation. It's a client-side initiated operation that can fail and sometimes does, leaving users with questions how did that happen. Second, it encourages to create code where handlers are running for a long time, which is not something NServiceBus is designed for. Instead, the recommendation is to take long processing outside of NServiceBus code. There's a sample that demonstrates exactly that: Long-running operations with Azure Service Bus Transport.