I copied the Event Hub sample code to my project for event processor:
async Task IEventProcessor.CloseAsync(PartitionContext context, CloseReason reason)
{
Console.WriteLine("Processor Shutting Down. Partition '{0}', Reason: '{1}'.", context.Lease.PartitionId, reason);
if (reason == CloseReason.Shutdown)
{
await context.CheckpointAsync();
}
}
And I saw some exceptions thrown from await context.CheckpointAsync(); which invoked when reason == CloseReason.Shutdown.
How can I simulate this scenario in local debugging?
While the EventProcessorHost is running - invoke eventProcessorHost.UnregisterEventProcessorAsync()
- this will make sure IEventProcessor.close()
is invoked with CloseReason.Shutdown
.