Migrating Service Bus Queue trigger with retry options from v3 to v4

mattonecz 30 Reputation points
2024-03-21T15:25:16.6166667+00:00

Hello.

In azure functions v4 we register our functions in function.json which can contain also retry settings:

"retry": {
		"strategy": "exponentialBackoff",
		"maxRetryCount": 2,
		"minimumInterval": "00:00:10",
		"maximumInterval": "00:01:00"
	},

How can we migrate this to azure functions v4?

There is no such option in app.serviceBusQueue.

I found that it is probably possible to set it in host.json but than it affects whole application and not just 1 specific function.

Thank you

Matyas

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,908 questions
Microsoft 365 and Office Development Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2024-03-22T00:58:55.72+00:00

    Hi @mattonecz

    From what I can tell, you can still do that; see Azure Functions error handling and retry guidance | Microsoft Learn. The retry is part of the extension bundle, not necessarily the functions runtime. I say that because the bundle still has to be used with a valid runtime, but you should be covered with 4.x. If you use 5.x though, you can use serviceBus.clientRetryOptions in host.json; see Azure Service Bus bindings for Azure Functions | Microsoft Learn for more details.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.