This post was originally published here

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.
  2. Next, we will create an HTTP POST method and give a fake URL (URI) to allow the retry mechanism to kick in
  3. Finally, an HTTP response action with the status code of 200 to complete the Logic App

When we execute the Logic App, you will notice that the default retry mechanism (4 attempts, once every 20 seconds) will kick in.

After about 70 seconds, the fourth retry is performed.

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

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.

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 of this session here –

Feedback Survey

If you have any specific topics of interest at Middleware Friday, you can fill in this survey. Alternatively, you can tweet at @MiddlewareFri or drop an email to middlewarefriday@gmail.com with your topics of preference.

You can watch the Middleware Friday sessions here.

Author: Sriram Hariharan

Sriram Hariharan is the Senior Technical and Content Writer at BizTalk360. He has over 9 years of experience working as documentation specialist for different products and domains. Writing is his passion and he believes in the following quote – “As wings are for an aircraft, a technical document is for a product — be it a product document, user guide, or release notes”. View all posts by Sriram Hariharan