{tocify} $title={Table of Contents}
From the Azure Portal select Create a resource -> search of “Logic App” -> click Create button
Note : Batch trigger is a special trigger meant for collecting messages and it only starts the instance once it's release condition is met - so you won't see it's instance in run history till it reaches it's release point.
Also you would not be able to call it outside of your subscription or from different region.
From the Azure Portal select Create a resource -> search of “Logic App” -> click Create button.
In designer select http tigger and in next action search for Batch, you should see all the logic apps which have Batchtrigger, select the one created in above step.
That's it, ready to use.
Introduction
One of my connection on Linkedin asked for help
In last post Batching(Aggregating) messages in Logic App we saw how to group JSON messages, in this post let's see how to batch XML message.
One of the primary thing to consider is valid that XML document has single Root Node.
We would create two logic app 1. XMLBatchProcessor 2. BatchProcessCaller
So basically his requirement is to send all the individual records in a group to CRM endpoint i.e. a Batch of individual records. This is called Aggregator or Batching pattern in Integration.
When we say we want to group messages then comes a question as to how to wrap them. In BizTalk we handle such scenario with help of Envelope schema (for Debatching and Batching).
In logic app there is a special trigger for grouping of the messages - Batch trigger.
In last post Batching(Aggregating) messages in Logic App we saw how to group JSON messages, in this post let's see how to batch XML message.
One of the primary thing to consider is valid that XML document has single Root Node.
We would create two logic app 1. XMLBatchProcessor 2. BatchProcessCaller
Steps to implement Aggregator/Batching Pattern in Logic App
Create a XMLBatchProcessor Logic App
From the Azure Portal select Create a resource -> search of “Logic App” -> click Create button
After instance is created, go to logic app designer and to add trigger - search for Batch. Select the Batch message trigger and configure batch process trigger .
- Batch Mode
Here we have two option
- Inline: For defining release criteria inside the batch trigger itself (for this post am using this - it's kind of hard coding).
IMO This should be opted if you don't have integration account or you have limited batch processing requirement.
- Integration Account: Ideally, this is should be preferred, as it helps for defining multiple release criteria configurations and also you don't have to make updates in Logic app every time release criteria is changed . It is like a configuration file sitting in an integration account,so you can maintain these configurations all in one place rather than in separate logic apps
- Batch Name
The name for your batch, which is "CommonBatch" in this example and applies only to Inline batch mode
- Release Criteria
As we have used Inline batch mode, we need to select the criteria to meet before processing each batch (we can select multiple criteria also):
- Message count based: Release the batch based on the number of messages collected by the batch.
- Size based: Release the batch based on the total size in bytes for all messages collected by that batch.
- Schedule: Release the batch based on a recurrence schedule, which specifies an interval and frequency. In the advanced options, you can also select a time zone and provide a start date and time.
- Select all: Use all the specified criteria.
Here Message count is selected with count as 3
Now, what you want to do with Batched Message?
We want to wrap this group of xml messages with a Root element tag, so that we get a valid XML Batched message and then finally can send it to the required destination for further processing.
So how we do it -- one option would be to create Azure Function - you will have to write code which will accept the Batched items and return new batched message. And call this function from your logic app.
Another would be to use Inline code - but it is still in preview and currently only supports Java Script.
Here we will make use of string Variable, using which we do following
Initialize variable with Start tag <RootNode>
So after the Batch Trigger step , add new action and select variable
Select Initialize variable
Give the Variable a Name , String as Datatype and against Value provide the start tag you want , here <BatchedMessages> is used
Keep on appending each Batched Item
Now add new action -- Append to string variable
Select Message Content of BatchedItems which is output of BatchTrigger step as a value to append. Note that For each gets automatically added.
Close the Rootnode tag </RootNode>
Next again we add Append Variable action after Foreach and add closing tag to it.
And now the final step is to send to destination -- for this post have used Send email action with attachment
Note : Batch trigger is a special trigger meant for collecting messages and it only starts the instance once it's release condition is met - so you won't see it's instance in run history till it reaches it's release point.
Also you would not be able to call it outside of your subscription or from different region.
Create a caller Logic App
From the Azure Portal select Create a resource -> search of “Logic App” -> click Create button.
In designer select http tigger and in next action search for Batch, you should see all the logic apps which have Batchtrigger, select the one created in above step.
As soon as you select it, Trigger Name and Workflow will be auto populated, against Batch Name give the same name used in step 1 and for Message content provide triggerbody.
That's it, ready to use.
Testing
Using Postman, sent 3 request(xml) having order details in it in it to the BatchProcessCaller logic app
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!
Learn More about Logic App
- How to configure Logic App Standard workflow behind Azure APIM
- How to Query Azure Table storage from Logic App | How to filter results of Azure Table storage from Logic App
- Understanding expressions in Logic Apps | Frequently used expressions in Logic Apps | What is expressions in Logic App
- How to use Logic app Run History | How to troubleshoot Logic App workflow execution
- Logic App and Slack - Sending messages to slack channel | Logic app and slack integration | Connecting Logic App to Slack channel
- How to access Application settings fields value from Logic app Standard workflow | Using Application settings as configuration store for Logic app standard workflow
- Developing Logic app standard workflow which uses Map locally and deploying to Azure
- Developing Logic App Standard Workflow Using Visual Studio Code | Create Logic App Standard Workflow Using Visual Studio Code
- Logic App - Xml to Json using Liquid Map | Append in Liquid Map
- How to use Azure Event Grid Custom Topic | Publishing and Subscribing from Azure Event Grid Custom Topic using Logic App
- Using Azure Storage Account Table as Config Store for Logic Apps | How to read and write from Logic App to Azure Storage Account Table
- Get Logic App Name in Logic App
- Difference between Logic App Consumption and Logic App Standard
- Getting Started with Logic App Standard | Overview of Logic App Standard | Basics of Logic App Standard
- How to find count of Logic App executions using Azure Portal
- Azure Functions vs Azure Logic App | Difference between Azure Functions and Azure Logic App
- Getting started with Logic App : Liquid Map | Using Liquid template in Logic app
- How to get actual error message of Scope in Logic App | Exception Handling in Logic app
- Interview questions and answers on Logic Apps | Interview questions for azure logic app developers
- How to execute Stored Procedure in Logic App | How to connect to SQL in Logic App
- How to get current date in logic app | How to format date time in Logic App
- BizTalk Developer getting started with Logic App
- Getting Started with Logic Apps - Fundamentals
- Getting Started with Logic Apps - Enterprise Application Integration
- Getting Started with Logic Apps - AS2
- Getting Started with Logic Apps - EDI X12 Fundamentals
- Getting Started with Logic Apps - XML to EDI X12
- Getting Started with Logic Apps - EDI X12 to XML
- Getting Started with Logic Apps - What happened to the Request?
- Inserting Multiple Records In On Prem SQL Using Logic App
- Inserting data in On Premises SQL Database using Logic Apps
- Installing and Configuring On Premises Data Gateway - By adding user to Active Directory
- XML Batching(Aggregation) in Logic App
- Batching(Aggregating) messages in Logic App
- Debatching(Splitting) JSON Message in Logic Apps - ForEach and SplitOn
- Debatching(Splitting) XML Message in Logic Apps - ForEach and SplitOn
- Securing Logic App with Azure Active Directory authentication
- Removing ns0: prefix from xml output from BizTalk/Logic app XSLT map
- Using Managed Identity in Logic Apps for Calling Active Directory Secured Function App
- Logic Apps : Fetching ISA and GS Segment Values From Interchange Envelope and Mapping
- Logic Apps : For Each Inside a For Each - Fetching values from field in an array inside an array
- How to configure Logic App Standard workflow behind Azure APIM
- How to Query Azure Table storage from Logic App | How to filter results of Azure Table storage from Logic App
- Understanding expressions in Logic Apps | Frequently used expressions in Logic Apps | What is expressions in Logic App
- How to use Logic app Run History | How to troubleshoot Logic App workflow execution
- Logic App and Slack - Sending messages to slack channel | Logic app and slack integration | Connecting Logic App to Slack channel
- How to access Application settings fields value from Logic app Standard workflow | Using Application settings as configuration store for Logic app standard workflow
- Developing Logic app standard workflow which uses Map locally and deploying to Azure
- Developing Logic App Standard Workflow Using Visual Studio Code | Create Logic App Standard Workflow Using Visual Studio Code
- Logic App - Xml to Json using Liquid Map | Append in Liquid Map
- How to use Azure Event Grid Custom Topic | Publishing and Subscribing from Azure Event Grid Custom Topic using Logic App
- Using Azure Storage Account Table as Config Store for Logic Apps | How to read and write from Logic App to Azure Storage Account Table
- Get Logic App Name in Logic App
- Difference between Logic App Consumption and Logic App Standard
- Getting Started with Logic App Standard | Overview of Logic App Standard | Basics of Logic App Standard
- How to find count of Logic App executions using Azure Portal
- Azure Functions vs Azure Logic App | Difference between Azure Functions and Azure Logic App
- Getting started with Logic App : Liquid Map | Using Liquid template in Logic app
- How to get actual error message of Scope in Logic App | Exception Handling in Logic app
- Interview questions and answers on Logic Apps | Interview questions for azure logic app developers
- How to execute Stored Procedure in Logic App | How to connect to SQL in Logic App
- How to get current date in logic app | How to format date time in Logic App
- BizTalk Developer getting started with Logic App
- Getting Started with Logic Apps - Fundamentals
- Getting Started with Logic Apps - Enterprise Application Integration
- Getting Started with Logic Apps - AS2
- Getting Started with Logic Apps - EDI X12 Fundamentals
- Getting Started with Logic Apps - XML to EDI X12
- Getting Started with Logic Apps - EDI X12 to XML
- Getting Started with Logic Apps - What happened to the Request?
- Inserting Multiple Records In On Prem SQL Using Logic App
- Inserting data in On Premises SQL Database using Logic Apps
- Installing and Configuring On Premises Data Gateway - By adding user to Active Directory
- XML Batching(Aggregation) in Logic App
- Batching(Aggregating) messages in Logic App
- Debatching(Splitting) JSON Message in Logic Apps - ForEach and SplitOn
- Debatching(Splitting) XML Message in Logic Apps - ForEach and SplitOn
- Securing Logic App with Azure Active Directory authentication
- Removing ns0: prefix from xml output from BizTalk/Logic app XSLT map
- Using Managed Identity in Logic Apps for Calling Active Directory Secured Function App
- Logic Apps : Fetching ISA and GS Segment Values From Interchange Envelope and Mapping
- Logic Apps : For Each Inside a For Each - Fetching values from field in an array inside an array
Tags:
Azure Logic Apps
Thanks a lot Mahesh
ReplyDeleteYou are really doing a great job by helping others ....
I wish, More power to you!!