我将Event Hub示例代码复制到我的事件处理器项目:
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();
}
}
我看到了一些从等待context抛出的异常.CheckpointAsync();当reason == CloseReason.Shutdown时调用。
如何在本地调试中模拟这种情况?
答案 0 :(得分:1)
当EventProcessorHost正在运行时 - 调用eventProcessorHost.UnregisterEventProcessorAsync()
- 这将确保IEventProcessor.close()
调用CloseReason.Shutdown
。