Logic Apps: the new batch feature!

Jon Fancey announced at Integrate the out-of-the-box batching feature in Logic Apps!  This early morning, I saw by accident that this feature is already released in West-Europe.  This blog contains a short preview of the batching functionality.  There will definitely be a follow up with more details and scenarios!

In batching you need to have two processes:

  • Batch ingestion: the one responsible to queue messages into a specific batch
  • Batch release: the one responsible to dequeue the messages from a specific batch, when certain criteria are met (time, number of messages, external trigger…)

Batch Release

In Logic Apps, you must start with the batch release Logic App, as you will need to reference it from the batch ingestion workflow.  This is to avoid that you are sending messages into a batch that does not exist!  This is how the batch release trigger looks like:

batch1

You need to provide:

  • Batch Name: the name of your batch
  • Message Count: specify the number of messages required in the batch to release it

In the future, definitely more release criteria will be supported.

Batch Ingestion

Now you can inject messages into the batch.  Therefore, I created just a simple request / response Logic App, that contains the Send messages to batch action.  First you need to specify the previously created Logic App that is responsible for the batch release.

batch2

Once you’ve done this, you can specify all required info.

batch3

You need to provide:

  • Batch Name: the name of the batch.  This will be validated at runtime!
  • Message Content: the content of the message to be batched.
  • Partition Name: specify a “sub-batch” within the batch.  In my scenario, all invoices for one particular customer will be batched together.  If empty, the partition will be DEFAULT.
  • MessageId: a message identifier.  If empty, a GUID will be generated.

The result

I’ve just triggered the batch-ingest Logic Apps many times.  This queues messages within the batch.

batch4

Each time 5 messages, belonging to the same partition, are available in the batch, the batch release Logic App gets fired.

batch5

The output looks like this:

{ 
   "body": 
   { 
      "batchName": "Invoice", 
      "partitionName": "Microsoft", 
      "items": [ 
         { 
            "messageId": "b61f1cc0-bef1-446e-a7b6-9083e8b95449", 
            "content": { "Amount": 50, "InvoiceRef": "DEF" } 
         }, 
         { 
            "messageId": "d00dd0f6-0f12-4417-b253-fdcd8650cc4a", 
            "content": { "Amount": 75, "InvoiceRef": "GHI" } 
         }, 
         { 
             "messageId": "4160c1e4-5c51-49c9-a938-dc1e7e9c3e4a", 
             "content": { "Amount": 125, "InvoiceRef": "MNO" } 
         }, 
         {
             "messageId": "a119a179-10d6-4c19-bed5-fe3616543e63", 
             "content": { "Amount": 25, "InvoiceRef": "ABC" }
         },
         { 
             "messageId": "dee3b716-5150-4714-9943-88c1ae260a49", 
             "content": { "Amount": 100, "InvoiceRef": "JKL" } 
         } 
      ] 
   } 
}

Conclusion

Very happy to see this has been added to the product, as batching is still required nowadays.  I thought this would have been part of the Integration Account; cool to see there is no dependency on that.  The batch release process is not using a polling trigger, so this saves you also some additional costs.

I’ll get in touch with the product group for some feedback, but this looks already very promising!

Advertisements

One thought on “Logic Apps: the new batch feature!

  1. Pingback: Logic Apps Live Recap – July 26, 2017 | toon vanhoutte

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