Bhav
Bhav

Reputation: 2207

Error when using the ExponentialBackoffRetry attributed in an Azure isolated function

I've got an Azure isolated function like so:

    [Function("TransactionEventsIntegration")]
    [ExponentialBackoffRetry(maxRetryCount: 3, minimumInterval: "00:00:02", maximumInterval: "00:05:00")]
    [ServiceBusOutput("%Transactions:SB:Transactions:ProcessorUpdateQueue%", Connection = "Transactions:SB:Transactions")]
    public async Task<ServiceBusMessage> Process(
        [ServiceBusTrigger(
            "%Transactions:SB:Transactions:ReceiveTopic%",
            "%Transactions:SB:Transactions:TransactionEventsTopicSubscription%",
            Connection = "Transactions:SB:Transactions")]
        ServiceBusReceivedMessage message,
        ServiceBusMessageActions messageActions,
        Microsoft.Azure.WebJobs.ExecutionContext executionContext)
    {
        // code
    }

This returns the following error:

Invalid use of a retry attribute. Check that the attribute is used on a trigger that supports function-level retry. (https://aka.ms/azfw-rules?ruleid=AZFW0012)

Upvotes: 0

Views: 29

Answers (1)

qkfang
qkfang

Reputation: 1775

The Service Bus trigger in function app does not support function level retry, but you can configure retry in the Binding extension level for all the functions.

Rule description
This rule is triggered in two scenarios:

A retry strategy is not recognized (only Fixed Delay and Exponential Backoff are supported)
A retry attribute is used on a trigger type that does not support function-level retry.
A list of triggers that support function-level retry can be found here.

enter image description here

{
    "version": "2.0",
    "extensions": {
        "serviceBus": {
            "clientRetryOptions":{
                "mode": "exponential",
                "tryTimeout": "00:01:00",
                "delay": "00:00:00.80",
                "maxDelay": "00:01:00",
                "maxRetries": 3
            },
            "prefetchCount": 0,
            ..........
        }
    }
}

Upvotes: 1

Related Questions