0

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?

Youxu
  • 1,050
  • 1
  • 9
  • 34
  • What exceptions? Can you post them? – Peter Bons Nov 24 '16 at 16:57
  • Thanks Peter. It is leaselost exception. You can find details from my another post: http://stackoverflow.com/questions/40733546/about-microsoft-servicebus-messaging-leaselostexception – Youxu Nov 25 '16 at 00:43

1 Answers1

1

While the EventProcessorHost is running - invoke eventProcessorHost.UnregisterEventProcessorAsync() - this will make sure IEventProcessor.close() is invoked with CloseReason.Shutdown.

See this to understand EPH concepts.

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