Reputation: 173
I'm trying to find out if there is any way to modify the webjobs sdk retry policy.
Right now if a webjob throws an exception it is re-queued straight away. This isn't ideal especially if the error was due to something like a DB timeout.
Does anyone know if the policy is modifiable to something like an exponential backoff ? Or so other workaround ?
Upvotes: 3
Views: 1317
Reputation: 176
As far as I know, the SDK does not support a configurable retry policy (not to be confused with the queue client's retry policy). If I'm understanding your intentions, you would want to catch the exception, call DeleteMessage
to pull it off the queue, and re-enqueue an identical message with a longer initial visibility delay, then rethrow the exception. You would need to keep track of the number of dequeues within the message itself, since deleting the message will delete the DequeueCount. If you wanted to backoff and retry the operation that caused the exception (while holding onto the queue message), you can call UpdateMessage
to extend the visibility timeout, and then finally throw an exception.
Upvotes: 2