Following the EventProcessorHost example we implemented our custom logic in onEvents(). Some data is not being processed and I suspect this is because of the warnings thrown by the Java client.
In the log we see StorageException (time-out on blob storage for renewing leases or checkpointing), LeaseLostException (probably due to the previous exception) and EventHubException (when event hub move or go offline for a short period).
Basically my question is: How do these exceptions impact the processing of events and how can we make sure no events are skipped (e.g. via exception handling with retry and completely shutdown as last resort)?
I read through the docs and searched through other questions unable to find a satisfactory answer (this and this one provide some insight).
Our code:
public class EventProcessor implements IEventProcessor {
...
@Override
public void onEvents(PartitionContext context, Iterable<EventData> events) throws Exception {
for (EventData event : events) {
try {
String message = new String(event.getBytes(), StandardCharsets.UTF_8);
mystuff.process(message);
this.checkpointBatchingCount++;
if ((checkpointBatchingCount % 50) == 0) {
context.checkpoint(data).get();
}
} catch (Exception e) {
LOG.warn("Processing event failed: {}", e.getMessage())
}
}
}
...
}
来源:https://stackoverflow.com/questions/50953546/data-not-being-processed-by-azure-event-hub-java-client