Close

Retry in Logic Apps


For easy reference this information is taken from the Microsoft Azure site.

HTTP actions and API Connections (like the Azure Storage API, SharePoint API or child workflows) support retry policies.  A retry policy applies to intermittent failures (characterized as HTTP status codes 4xx (408, 429) and 5xx as well as any connectivity exceptions) and is described using the retryPolicy object.

The retry interval is specified in the ISO 8601 format.  Its default value is 20 seconds, which is also the minimum value. The maximum value is 1 hour. The default retry count is 4. 4 is also the maximum retry count. To disable the retry policy, set its type to None.

If you don’t add a retry interval, the default retry interval will be applied. The default retry policy is: 4 retries with a 20 second interval

In the example below, we have defined a retry policy that will retry an action 2 time in case of intermittent failures, for a total of 3 executions, with a 30 second delay between each attempt:

“PostAGAssets”:
“retryPolicy” : {
“type”: “fixed”,
“interval”: “PT30S”,
“count”: 2
}
For an expanation of the ISO8601 interval notation, see the following link.
Retry seems like a good idea, but it may have a counterproductive effect in the Azure Portal. Because of all the retries we see five failing logic app runs, not just one. This situation gets worse if we use nested workflows.
In the example below we see a child workflow being called with a retry interval None. Next we see a Http action. Note that the retry policy is contained in the inputs section of the action.

Child workflow:
“ProcessAGADocument”:
{
“type”: “Workflow”,
“inputs”: {
“host”: {
“triggerName”: “manual”,
“workflow”: {
“id”: “[concat(‘/subscriptions/1ea9735d-00df-4375-86d5-d0d35362dd7f/resourceGroups/’, variables(‘rg’), ‘/providers
/Microsoft.Logic/workflows/’, parameters(‘logicAppProcessAGADocument’))]”
}
},
“body”: {
“RegionCode”: “@{triggerBody()[‘RegionCode’]}”,
“BestandsNaam”: “@{item().BestandsNaam}”,
“DocumentId”: “@{item().DocumentId}”,
“IntegrationId”: “@{body(‘ConvertIntegrationId’).IntegrationId}”,
“FormCode”: “@{item().FormCode}”,
“DocumentType”: “@{item().DocumentType}”
},
“retryPolicy”: {
“type”: “none”
}
},
“runAfter”: {}
}
},
“runAfter”: {
“FilterAGAAttachments”: [
“Succeeded”
] }
}

Http Action:
“GetDocument”:
{
“type”: “Http”,
“inputs”: {
“method”: “GET”,
“uri”: “https://@{encodeURIComponent(parameters(‘gmfBaseUrl’))}/api/gmf/@{triggerBody()[‘RegionCode’]}/document
/@{item().DocumentId}”,
“headers”: {
“PlatformUser”: “[parameters(‘gmfUser’)]”
},
“authentication”: {
“type”: “Basic”,
“username”: “[parameters(‘gmfUser’)]”,
“password”: “[parameters(‘gmfPassword’)]”
},
“retryPolicy”: {
“type”: “none”
}
},
“runAfter”: {}
}

Http Action(2):
“PostAGAFoto”:
{
“type”: “Http”,
“inputs”: {
“method”: “post”,
“queries”: {
“regionCode”: “@{triggerBody()[‘RegionCode’]}”,
“formCode”: “@{triggerBody()[‘FormCode’]}”,
“integrationId”: “@{triggerBody()[‘IntegrationId’]}”,
“documentId”: “@{triggerBody()[‘DocumentId’]}”,
“bestandsNaam”: “@{triggerBody()[‘BestandsNaam’]}”
},
“uri”: “https://@{encodeURIComponent(parameters(‘ahakStorageConnectorName’))}.azurewebsites.net/api/Storage/PostAGAFoto”,
“retryPolicy”: {
“type”: “none”
}
},
“runAfter”: {
“DeleteAGAFoto”: [
“Succeeded”
] },
“metadata”: {
“apiDefinitionUrl”: “https://@{encodeURIComponent(parameters(‘ahakStorageConnectorName’))}.azurewebsites.net/swagger/docs/v1”,
“swaggerSource”: “website”
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *