提醒我如何将 HTTP 数据拆分为并行分支并在逻辑应用程序中执行进一步的步骤?

Alert me How to split HTTP data into parallel branch and execute further steps in logic app?

我有 HTTP call 调用 API 和 gives 500 records

For 500 records its taking to much long so i'm thinking to branch it in 5 different branches where i will pass 100 records each to execute everything in less time ,what is suggestion ?

我想 create branches which will process 100 records for each branch 但是 how to send 100 separate records to each branch?

我想这样做是为了节省我的执行时间,我也在 foreach 中尝试了并发,但它仍然花费太多时间来处理 500 条记录,所以我虽然可以将这些记录拆分成分支

我可以在哪里使用 SplitOn

"HTTP_2": {
                        "inputs": {
                            "headers": {
                                "Authorization": "@{concat('Bearer ',variables('accesstoken'))}",
                                "Ocp-Apim-Subscription-Key": "demovalues"
                            },
                            "method": "GET",
                            "uri": "http://demo"
                        },
                        "runAfter": {
                            "Set_variable_AccessToken": [
                                "Succeeded"
                            ]
                        },
                        "type": "Http"
                    },



                     "foreach": "@body('HTTP_2')?['results']",
                        "runAfter": {
                            "Increment_variable_SkipVariable": [
                                "Succeeded"
                            ]
                        }

对于 SplitOn 属性 我尝试这样添加 - 但在保存逻辑应用程序时出现错误。

 "HTTP_2": {
                            "inputs": {
                                "headers": {
                                    "Authorization": "@{concat('Bearer ',variables('accesstoken'))}",
                                    "Ocp-Apim-Subscription-Key": "demovalues"
                                },
                                "method": "GET",
                                "uri": "http://demo"
                            },
                            "runAfter": {
                                "Set_variable_AccessToken": [
                                    "Succeeded"
                                ]
                            },
                            "type": "Http",
                            "splitOn": "@Body('HTTP_2')?['results']",
                        }

error getting after adding- The request content is not valid and could not be deserialized: 'Could not find member 'splitOn' on object of type 'FlowTemplateAction'. Path 'properties.definition.actions.Run_the_code_until_all_records_completed_with_each_500_interations.actions.HTTP_2.splitOn', line 1, position 494638.'

逻辑应用程序在您的触发器中提供了一个 SplitOn 属性 来对数组进行分批处理。它适用于当你想处理数组或消息中任何重复的元素并单独处理它们并减少执行时间时如果使用 for each 循环。

基本使用可以参考官方文档:Trigger multiple runs. And if you are calling sql or Azure table etc to get records, you could use two logic apps to implement it. This wiki could help you:Azure LogicApp Debatching.

这种方法的优点是每个 child 消息立即独立于其他消息开始处理。如果一条消息在进一步处理过程中失败,它不会影响其他消息,并且可以在 child 消息级别完成异常处理。

提醒如果使用SplitOn属性,它将生成一个单独的逻辑应用程序实例并并行处理各个订单。

更新: 下面是我用来处理存储 table 实体的示例。两者都是 HTTP 触发的,parent 一个获取 table 值,然后调用 child 一个(将 Content-Type=application/json 设置为实体主体) .

而 child 只是在触发器下设置 "splitOn": "@triggerBody()['value']"提醒只能用触发器设置。

这是结果。 parent会得到四个实体值,child逻辑会拆分成四个并联一个。

从下图中您可以发现每个分支只获得一个值,然后在 HTTP 触发器之后您可以添加相同的操作。