从 EventHostProcessor 中的最后一个检查点重新开始消费

Restart consumption from last checkpoint in EventHostProcessor

鉴于 EventHostProcessor 的实现,我如何强制重播同一处理器中最后一个检查点的事件?

明确地说,假设我的分区是 100 深并且我已经消耗了 10 条消息。当我调用此重放方法时,我希望 onEvent 到 return 来自我之前使用的 10.

的第一条消息

在 C# 中,这似乎可以通过使用 Stopwatch 但我没有看到 Java 等价物。

简单的方法是使用Java StopWatch class of Apache Commons Lang library and following the C# code in the tutorial Receive events from Azure Event Hubs using the .NET Framework to write the same feature code in Java with azure-event-hubs-java library (on GitHub here, maven dependency for EventProcessorHost here).

希望对您有所帮助。

解决方案似乎是您可以检查点到最后使用的 EventData 的高水位线,或者您可以检查点到另一个 EventData 实例。

比如context.checkpoint(data);

似乎没有办法在 EventProcessorHost 中任意倒回到较早的事件。