-
Notifications
You must be signed in to change notification settings - Fork 107
Manually marking Service Bus Queue Function as Failed #1383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Facing this issue right now with local testing. There should be a functionality like in c# to be able to set autoComplete to False or a special exception in the azure.functions.ServiceBus class that a service bus trigger will listen to and mark it as a failed function without trying to retry the function again. |
Any update on this? |
Any update on this ? |
The only solution i've found for now is to move message to dead letter queue and then rethrow exception. This sample can help |
@andreyshv I'm running into this too and think you're right that dead-lettering is the correct action. However, I'm stuck on actually implementing the call to |
@alecglen sorry, but i work with .net not python. Below is my code in c#. It's differs from python of course but idea the same.
|
One would hope, but unfortunately the Python worker is not designed to support that flow currently. Ultimately for our Python Function, we worked around this by flipping the script. The Function is configured without retries so errors are dead-lettered by default. Then for the specific cases that we do see value in retrying, we catch the errors and manually add a new copy of the message to queue before exiting. Definitely some drawbacks and wouldn't work for every case, but it's working for us. |
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?
The text was updated successfully, but these errors were encountered: