My event processor sometimes receive exception when checkpointing:
System.AggregateException: One or more errors occurred. ---> >Microsoft.ServiceBus.Messaging.LeaseLostException: Exception of type >'Microsoft.ServiceBus.Messaging.LeaseLostException' was thrown. ---> >Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an >error: (412) A lease ID was specified, but the lease for the blob has expired.. ->--> System.Net.WebException: The remote server returned an error: (412) A lease >ID was specified, but the lease for the blob has expired.
Can I renew lease just before checkpoiting in ProcessEventsAsync method? Or how can I manage PartitionManagerOptions to make this work?
Code:
public virtual Task ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
{
//some processing
context.CheckpointAsync().Wait();
return Task.FromResult(0);
}
Thanks for your help
This happens if the
EPH
(EventProcessorHost) whenever,EPH
loadbalancesEventHubs
partitions across 'EPH
instances and is harmless if you see it once in a while (aka less frequently).refer to this for detailed explanation on Lease Management.