azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

Manually marking Service Bus Queue Function as Failed

Open garoplin opened this issue 6 months ago • 4 comments

Is your question related to a specific version? If so, please specify: Programming Model V1, Azure FUnction v4, python 3.10

What binding does your question apply to, if any? (e.g. Blob Trigger, Event Hub Binding, etc) Service Bus Queue

Question

Currently I have policy of retrying setup on function and Service Bus level. When the processing throws an error the message goes back to queue 3 times as expected (defined by property Max delivery count). However, for some types of exceptions I don't want to retry processing, because I know the retry won't help and it's pointless to waist computing power for that. So I can't catch the exception on the top level, check whether I should retry or no. The problem is that I still want to throw that exception after catching it, so the function execution will be marked as failed. Is there any way to mark the message as completed and then throw the exception? Or to silence the exception but add some kind of property to function execution context, so that it will be visible as failed?

garoplin avatar Dec 18 '23 16:12 garoplin