(412)指定了租约ID,但blob的租约已过期

时间:2017-01-05 11:51:54

标签: c# azure azureservicebus azure-eventhub

我的事件处理器有时会在检查点时收到异常:

  

System.AggregateException:发生了一个或多个错误。 ---> > Microsoft.ServiceBus.Messaging.LeaseLostException:类型>异常抛出'Microsoft.ServiceBus.Messaging.LeaseLostException'。 ---> > Microsoft.WindowsAzure.Storage.StorageException:远程服务器返回了>错误:(412)指定了租约ID,但blob的租约已过期... - > - > System.Net.WebException:远程服务器返回错误:(412)指定了租约> ID,但blob的租约已过期。

我可以在ProcessEventsAsync方法中的checkpoiting之前续订租约吗? 或者我如何管理PartitionManagerOptions以使其工作?

代码:

public virtual Task ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
{
    //some processing
    context.CheckpointAsync().Wait();
    return Task.FromResult(0);
}        

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

如果EPH(EventProcessorHost)每当EPH负载均衡EventHubs跨{&#39; EPH个实例进行分区,并且如果您在虽然(也不那么频繁)。

有关租赁管理的详细说明,请参阅this