Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For_each concurrency and variable interference in Azure Logic App

I have a logic app that uses For_each to iterate through email attachments and saves them to an Azure Files container.

Depending on some conditions, I want the attachment stored with a different name or at a different path, but the default concurrency of for_each is concerning; I have path and file name variables set at top level and I'm setting them in the loop as conditions are met.

Is there a way to be sure that these variables will hold the value I'm setting in that iteration without setting concurrency to 1?

It seems like it's working correctly with default concurrency, but I'm going to set concurrency to 1 until I'm sure about whether or not these iterations can interfere with each other in terms of setting variables.

like image 775
spongessuck Avatar asked Jan 31 '18 14:01

spongessuck


People also ask

What is concurrency control in logic apps?

A way to solve the problem we had above is to enable concurrency control in our logic app. By enabling this you can select how many steps of the loops can run at the same time. By setting this to one you can make sure the main loop which loops through every message is ran one at the time.

What are the types Azure logic apps triggers?

Triggers are generally of two types: Polling Trigger – It checks a service's endpoint at regular intervals. Push Trigger – It creates a subscription to an endpoint and provides a call-back URL so the endpoint can notify the trigger when the specified event happens, or data is available.

Can logic app have multiple triggers?

Multiple triggers can be accommodated in a Logic App workflow. As mentioned by Microsoft Azure, a single Logic App can have up to 10 triggers in it.

What is the difference between logic app consumption and standard?

To create a logic app, you use either the Logic App (Consumption) resource type or the Logic App (Standard) resource type. The Consumption resource type runs in the multi-tenant Azure Logic Apps or integration service environment, while the Standard resource type runs in single-tenant Azure Logic Apps environment.


1 Answers

If you are changing the variable value inside the for-each loop (and potentially also consuming it in the same loop), you should set concurrency to 1 to ensure the loop runs in a sequential fashion to avoid racing conditions.

like image 129
Derek Li Avatar answered Oct 03 '22 00:10

Derek Li