Try for free Book a demo

Azure Logic Apps – Retry Policy (Middleware Friday)

Events

3 Mins Read | Last modified on July 25th, 2024

Azure-logic-apps-retry-policy

This blog will give you a recap of the feature content that was discussed as a part of Episode 22 of Middleware Friday. In this episode, Kent Weare discussed a small, yet very interesting feature in Azure Logic Apps – the Retry Policy.

Logic App Retry Policy

To understand the Retry Policy better, let’s assume we have an endpoint that is consumed by Logic Apps. If the endpoint has some intermittent issues, and the initial request fails to execute, the number of retries will be attempted based on the “retry count” default settings. By default, the retry action will execute 4 additional times over 20-second intervals. The retry policy applies to intermittent failure HTTP codes like 408, 429, 5xx series. You can define the retry policy as follows:

"retryPolicy" : {
     "type": "<type-of-retry-policy>",
     "interval": <retry-interval>,
     "count": <number-of-retry-attempts>
}

The maximum number of retry attempts that can be made is 4. If you try tweaking the retry count in the JSON, during the Logic App execution you will notice an exception as “The provided retry count of ‘value’ is not valid. The retry count must be a positive number no greater than ‘4’“. Similarly, the maximum delay for a retry can be set to 1 hour while the minimum delay is 5 seconds. Azure Logic Apps uses ISO 8601 standards for the above mentioned time durations and you need to define the interval in one of the following formats –

PnYnMnDTnHnMnS
PnW
P<date>T<time>

Demo – With Default Retry Mechanism

Kent demonstrated the Azure Logic App Retry Policy with the help of the following Logic App example –

Prerequisite: Create a Logic App before proceeding with the steps shown below

  1. First, let’s start with a Blank Logic App. In the Logic App designer, we will get started with creating a simple HTTP request trigger.
    http post url request
  2. Next, we will create an HTTP POST method and give a fake URL (URI) to allow the retry mechanism to kick in
    http method details
  3. Finally, an HTTP response action with the status code of 200 to complete the Logic App
    http response status code 200
 When we execute the Logic App, you will notice that the default retry mechanism (4 attempts, once every 20 seconds) will kick in.

default entry mechanism

After about 70 seconds, the fourth retry is performed.

entries of http method

Finally, after 80 seconds, the Logic App execution will fail and the corresponding error will be displayed in the Logic App Designer.

logic app execution error

You can alter the retry mechanism by entering the code view and modifying the code with the values as shown previously in the blog post.

logic app retry mechanism

Therefore, the demo clearly shows how the retry policy works out of the box in Logic Apps and how you can customize the retry policy within its limits. You can watch the video ofMiddleware Friday sessions here.

Related reading

This article was originally published on Jun 5, 2017. It was most recently updated on Jul 25, 2024.

Advanced Cloud Management Platform - Request Demo CTA

Related Articles