2

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

Praburaj
  • 613
  • 8
  • 21
  • I'm not sure that StackTrace indicates the exception occurred when calling CheckpointAsync. Or are you saying you saw that behavior in a debugger? – plukich Jan 05 '17 at 14:33

1 Answers1

1

This happens if the EPH (EventProcessorHost) whenever, EPH loadbalances EventHubs 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.

Community
  • 1
  • 1
Sreeram Garlapati
  • 4,877
  • 17
  • 33