Blog Post Contributors: Rama Krishna Rayudu (Principal Software Engineering Manager) and Kent Weare (Principal Product Manager)
Batching support is a capability found in Azure Logic Apps (Consumption) that allows developers to send and process messages together in a specific way as groups. This solution collects messages into a batch and waits until your specified criteria is met before releasing and processing the batched messages. Batching can reduce how often your logic app processes messages and help you manage the message flow within your interfaces. For additional information regarding how the Batch feature works, please refer to our documentation.
Recently, we had customer inquires about using the batch feature in Azure Logic Apps (Standard) as a built-in connector. Since built-in connectors run within your instance of Azure Logic Apps (Standard), they provide additional performance benefits and are not metered like Azure (managed) connectors.
As of this writing, the batch feature can be enabled in the Code view of Azure Logic Apps (Standard). In the future, we will add support in the workflow designer, but using the Code view will unblock customers who require this functionality now.
You can create a batch scenario by following these steps. You will need 2 workflows to be created within your Logic App (Standard) instance. One will be a receiver and the other will be a publisher.
Start with the receiver workflow by creating a new stateful workflow and copying the following workflow definition into a new workflow’s Code view. Stateless workflows are not currently supported. In addition, when configuring the batch mode, ensure you are using Inline as specified in the code sample. Currently, we only support Inline with Azure Logic Apps (Standard) and don't offer Integration Account support at this time.
The result should look like the following image. There are a couple important things to consider:
Make a note of your workflow’s name. You will need this value in your publisher workflow.
Within your trigger, make a note of the name of the value under configurations. In the example below, the name is testbatch. This value can be changed, but we will also need to provide this value in our publisher’s workflow.
Logic App Receiver (Code View)
Once you save your workflow configuration, you can click on the Designer where you can visually modify your workflow including the Batch trigger’s configuration and any other details.
Logic App Receiver (Designer View)
We are now ready to create our second stateful workflow. Once it has been created, can copy and paste the following code into the Code view.
As mentioned above, pay particular attention to the batchName and the workflow id to ensure the values in your workflow code match that of the receiver.
Logic App Publisher (Code View)
With your workflow code saved, you can now switch over to the Designer where you can make modifications to your workflow. If you decide to continue to use the Service Bus queue trigger, you will need to update your queue configuration and create a connection.
Logic App Publisher (Designer View)
You are now ready to test your workflows. If you would like to see a demo of this in action, please check out the following YouTube video: