Adding a parallel branch in an Azure Logic App allows you to execute multiple actions simultaneously. This is useful when you want to perform independent tasks concurrently, such as sending notifications, logging data, or calling multiple APIs.
Below is an example of a Logic App workflow that includes a parallel branch:
Example Scenario
Trigger: HTTP request to start the workflow.
Parallel Branches:
Branch 1: Create a file on an SFTP server.
Branch 2: Send an email notification.
Merge: Wait for both branches to complete before sending a final HTTP response.
Steps to Create the Workflow
Trigger: HTTP Request
Add an HTTP request trigger to start the workflow.
Define the JSON schema for the incoming request body (if applicable).
Add a Parallel Branch
After the trigger, click the + button and select Add a parallel branch.
This will create two parallel branches.
Branch 1: SFTP – Create File
Add an SFTP action to create a file on the SFTP server.
Configure the connection and specify the file path and content.
Branch 2: Send Email Notification
Add a Send email (V2) Gmail action (or another email connector) to send an email.
Configure the email details (e.g., recipient, subject, body).
Merge the Branches
After both branches, add a Condition or Response action to merge the branches.
Ensure the workflow waits for both branches to complete before proceeding.
Final Action: HTTP Response
Add an HTTP response action to send a final response back to the caller.
Include a success message or data from the parallel branches.
Here's how Logic App should look:
Key Points
Parallel Branches:
Use the Add a parallel branch feature to create independent actions that run concurrently.
Each branch operates independently and does not wait for the other to complete.
Merge:
After the parallel branches, add an action (e.g., HTTP response) that waits for both branches to complete.
Outputs:
You can include outputs from both branches in the final response or logging.
Error Handling:
Add exception handling within each branch if needed (e.g., retry policies or error responses).
You can download the logic app template from the estudy247 GitHub repository – la-test-parallel-06