I am trying to trigger an azure function on a change in cosmos db using the cosmos db changefeed. I am trying to trigger the function "at-least-once" using the available retry-policies: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=csharp
So, I have an azure-function triggered by a CosmosDbTrigger, which has no built-in resilience. I have declared an infinite retry-policy on this azure-function to remedy this. If the function fails for any reason, the retry-policy works as expected, and the function is rerun after a fixed delay. I can also verify that my lease-item in cosmosdb does not update as long as the function does not return a successful result. However, as soon as I stop my azure function and start it again, the function is not retried anymore. The lease has been updated and my only interpretation of this is that the checkpoint in the cosmos db has been advanced. (The behaviour is the same if I stop the application locally in visual studio, by disabling the function in azure, or by redeploying the function in azure)
My understanding is that the checkpoint should be advanced only on a successful result from the azure function, but it seems it is also advanced when the function application is stopped in between retry-runs. This makes it impossible for me to guarantee at-least-once execution of my function.
Can someone please try to explain to me, why the function is not retried after restart?
We are removing retry policy support in the runtime for triggers other than Timer, Kafka, and Event Hubs after this feature becomes generally available (GA). Preview retry policy support for all triggers other than Timer and Event Hubs was removed in December 2022. For more information, see the Retries section.
-- from learn.microsoft.com/en-us/azure/azure-functions/… dated 2023-09-07 Sad that I got so excited only to have my hopes dashed.