Azure / azure-functions-eventgrid-extension

EventGrid extension for Azure Functions
MIT License
48 stars 34 forks source link

Exception handling and retries #32

Closed aejmelaeus closed 6 years ago

aejmelaeus commented 6 years ago

I have been testing the EventGridTrigger and have a question/clarification.

When a function fails it is logged, but not retried from Event Grid. I guess this is by design?

If one would like to use the retry mechanisms in Event Grid, the regular HttpTrigger should be used instead?

Cheers

Weikko

watashiSHUN commented 6 years ago

Currently this is true

  1. eventGrid trigger function basically takes in an eventGrid event and expect void as return value, this does not give you any control over the http return code (although I think we can maybe improve this, ie expect a boolean return value, and we will send 400 back to eventGrid when we encountered "false" or exceptions)
  2. retry is more complicated when eventGrid enables batching (array of events in a single http request), if one of the entry causes a failure, eventGrid will resent the whole message, this would require extra work at client side to deduplicate. So for functions, we will return 202 when message is received from eventGrid and we will handle the retry of individual events in the extension (currently under development)
  3. However, for failures other than user code, ie 404, 401, 503 we will still trigger retry image
aejmelaeus commented 6 years ago

Thank you for the detailed reply. I understand the architectural concepts and therefore the current design.

I will use the HttpTrigger for now for retries and make the processing of messages idempotent.

I'm curious to understand the Event Grid delivery/batching strategy. What I have experienced the messages are always sent in batches of one. I haven't found anything in the docs about this.

Cheers

Weikko