是否有等效于 ASB 传输的 AutoRenewTimeout(TimeSpan)?

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

我们正在使用(非旧版)Azure 服务总线传输。我们可以使用等同于 AutoRenewTimeout(TimeSpan) 的东西吗?如果不是(如文档所建议的那样),传输如何处理长 运行 进程?

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

简短的回答是"no"。旧版传输包括 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 的选项,它准确地演示了:Long-运行 operations with Azure Service Bus Transport。