Search code examples
javaazureazure-eventhub

Restart consumption from last checkpoint in EventHostProcessor


Given an implementation of the EventHostProcessor, how can I force replay of events from the last checkpoint within the same processor?

To be clear, assume my partition is 100 deep and I have consumed 10 messages. When I invoke this replay method, I would then want onEvent to return the first message from my previously consumed 10.

In C# this seems possible through the use of the Stopwatch but I do not see the Java equivalent.


Solution

  • The solution seems to be that you can either checkpoint to the high-water mark of the last consumed EventData or you can checkpoint to another EventData instance.

    Such as context.checkpoint(data);

    There does not seem to be a way to arbitrarily rewind to an earlier event within an EventProcessorHost.