I have implemented an EventGrid Trigger to respond to Blob Storage Events the logic of which is simplified below :
public static async void Run(
JObject eventGridEvent,
TraceWriter log,
ExecutionContext context)
{
string eventContent = ParseEvent(eventGridEvent);
HttpClient client = GetProxyClient();
HttpResponseMessage response = await client.GetAsync("blabla/" + eventContent);
string responseContent = await response.Content.ReadAsStringAsync();
log.Info("Here is the response :" + responseContent);
}
The external API does not take long to respond (1 second or less) and my configuration for the host is set to default (so an unbounded number of concurrent calls is allowed).
I am getting a lot of duplicated events in the logs when adding multiple blobs (starting at just 2 blobs) at the same time (a script is quickly uploading the blobs one by one with no wait time in between).
I feel that this might be due to the fact that I never acknowledge receiving the events and I don't know if I am supposed to do this in my code or whether the EventGrid Trigger does that automatically.
Is the logic for acknowledging the processing of an event supposed to be implemented within an EventGrid Trigger (Http 200 response) or is this handled automatically?
If not should I still be getting duplicated events? Typically, when uploading a single blob I receive the event for it 3-4 times.
The reason I ask this question is that when using a Http Trigger and returning a 400 response I also get duplicated events which makes sense since I am not acknowledging having correctly processed the event. However, when I return a 200 response then I do not receive duplicated events.
Thanks