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…)
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:
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.
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.
Once you've done this, you can specify all required info.
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.
I've just triggered the batch-ingest Logic Apps many times. This queues messages within the batch.
Each time 5 messages, belonging to the same partition, are available in the batch, the batch release Logic App gets fired.
The output looks like this:
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!