1
votes

I use the EventHub support of the Azure WebJobs Sdk to process Events. Because of the throughput I decided to go for batch processing of those Events, e.g. my method looks like this:

public static void HandleBatchRaw([EventHubTrigger("std")] EventData[] events) {...}

Now one of those events within a batch might cause an Exception - what's the right way to handle that? When I leave the Exception uncaught the processing stops and the remainder of the Events in the EventData[] parameter get lost.

Options:

  1. Catch the Exception manually, forward the Event to some place else and continue
  2. Let the SDK do the magic, e.g. it should just 'ACK' the Events processed until then (I probably would have to do that), mark this event as 'Poisoned', exit the method and continue on the next call of the function.
  3. Move to Single Event Handling - but for performance goals I don't feel that's right
  4. I missed the point and should think of another strategy

How should I approach this?

2
As I know, when event executed failed, then SDK will retry the event.Tom Sun - MSFT

2 Answers

0
votes

There are only four choices in any messaging solution: 1 Stop 2 Drop 3 Retry 4 Dead letter

You have to do that. I don't believe that SDK will retry anything. Recall there is no ACK for Event Hubs read, you just read.

How are you checkpointing?

0
votes

Your best bet is probably your option #1. WebJobs EventHub binding doesn't give you many options here. Feel free to file an issue at https://github.com/Azure/azure-webjobs-sdk/issues to request better error handling support here.

If you want to see exactly what it's doing under the hood, here's the spot in the WebJobs SDK EventHub binding that receives events via EventProcessorHost: https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.ServiceBus/EventHubs/EventHubListener.cs#L86