Parallel Processing in Logic App

Introduction

Logic Apps provide a way to simplify and implement scalable integrations and workflows in the cloud. It provides a visual designer to model and automate your process as a series of steps known as a workflow. There are many connectors across the cloud and on-premises to quickly integrate across services and protocols.

Whilst designing your Logic App, sometimes we need to process list of actions in parallel. For example, we may want to call 2 REST services in parallel, combine the results and return the result. For that, we could use parallel action shape. The Parallel Actions shape (Parallel Actions shape) provides a mechanism by which two or more different actions can take place concurrently but independently.

Background

In this example, we are going to use the below REST API. In our Parallel Shape, we are going to get 1st and 2nd post using this API and return both the results as a reponse of this API.

 

Using the code

Create a blank Logic app and add an Request shape which takes our http request.

following that add an HTTP action which gets the first post.

Now add the parallel action by clicking the ‘+’ symbol in between the Request and HTTP actions.

Now your Logic App would looks like,

Add another HTTP action for the second post.

Add a response action.

your logic app would looks like below,

 

We could test it using POSTMAN, save the logic app and the URL to call this API would be listed in the HTTP shape.

Now we shall get a inappropriate response it the POSTMAN tool,

Post1 and Post2 elements in the response contains the whole response of the API, to getch the exact post we need to fetch body element of the API.

To do that, switch back to code window and edit those values

 

Retrigger it from the POSTMAN,

 

Points of Interest

1. When creating JSON output in the HTTP response, first make a valid JSON and try to include the input otherwise, the input will not be included in the response.

{

“Post1″:””,

“Post2:””

}

2. While adding parallel shape, first bring atleast left leg’s actions, otherwise you cant see the parallel shape option at all.

History

Created Article.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

WordPress.com.

Up ↑

%d bloggers like this: