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. ()
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)
Share
Improve this question
edited Feb 4 at 3:29
Pravallika KV
8,7742 gold badges5 silver badges15 bronze badges
Recognized by Microsoft Azure Collective
asked Jan 30 at 9:16
BhavBhav
2,2079 gold badges41 silver badges79 bronze badges
1 Answer
Reset to default 1The 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.
- Following the link in the error message, https://aka.ms/azfw-rules?ruleid=AZFW0012, it goes to below page :
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.
Then follow the link in
here
text, it takes us to https://learn.microsoft/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=fixed-delay%2Cin-process%2Cnode-v4%2Cpython-v2&pivots=programming-language-csharp#retriesLooking at the row in the table below,
Service Bus
does not support function level configuration for retry. It only supportsBinding extension
that you can configure in the host.json.
- To configure the host.json, you can follow the link in above table and go to https://learn.microsoft/en-us/azure/azure-functions/functions-bindings-service-bus?tabs=isolated-process%2Cextensionv5%2Cextensionv3&pivots=programming-language-csharp#hostjson-settings
{
"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,
..........
}
}
}