Hello
I have a problem of possible out-of-order processing in my flow
The flow goes through an http-request, which I imagine is processed asynchronously. This introduce an uncertainty on the execution order.
On this example, we can see that the order of the messages at the output are not the same as the input. They can eventually be different at each execution.
[{"id":"9a86d59e88442f2c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9342a516f1bafda0","type":"inject","z":"9a86d59e88442f2c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"title\":\"ITEM A\"},{\"title\":\"ITEM B\"},{\"title\":\"ITEM C\"},{\"title\":\"ITEM D\"},{\"title\":\"ITEM E\"},{\"title\":\"ITEM F\"},{\"title\":\"ITEM G\"},{\"title\":\"ITEM H\"}]","payloadType":"json","x":430,"y":220,"wires":[["377fb634af59c3fa"]]},{"id":"fc962674bf19f1e9","type":"debug","z":"9a86d59e88442f2c","name":"Debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"\"Debug 1: title:\" & msg.save_details.title","targetType":"jsonata","statusVal":"","statusType":"auto","x":1020,"y":160,"wires":[]},{"id":"377fb634af59c3fa","type":"split","z":"9a86d59e88442f2c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":220,"wires":[["b7a7fc71bc9eb7cc"]]},{"id":"9e139c96772f9582","type":"http request","z":"9a86d59e88442f2c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://google.com","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":1050,"y":220,"wires":[["c651b52621a1c3d4"]]},{"id":"b7a7fc71bc9eb7cc","type":"change","z":"9a86d59e88442f2c","name":"save details","rules":[{"t":"set","p":"save_details","pt":"msg","to":"payload","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":220,"wires":[["fc962674bf19f1e9","9e139c96772f9582"]]},{"id":"c651b52621a1c3d4","type":"debug","z":"9a86d59e88442f2c","name":"Debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"\"Debug 2: title:\" & msg.save_details.title","targetType":"jsonata","statusVal":"","statusType":"auto","x":1220,"y":220,"wires":[]}]
Unfortuntately in that flow, I need to be sure that the http-request are executed at the server side in the right order.
So far the only workaround I found is to add a rate limiter before the http-request not to insure the flow is completed before the next request is performed.
[{"id":"9a86d59e88442f2c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9342a516f1bafda0","type":"inject","z":"9a86d59e88442f2c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"title\":\"ITEM A\"},{\"title\":\"ITEM B\"},{\"title\":\"ITEM C\"},{\"title\":\"ITEM D\"},{\"title\":\"ITEM E\"},{\"title\":\"ITEM F\"},{\"title\":\"ITEM G\"},{\"title\":\"ITEM H\"}]","payloadType":"json","x":430,"y":220,"wires":[["377fb634af59c3fa"]]},{"id":"fc962674bf19f1e9","type":"debug","z":"9a86d59e88442f2c","name":"Debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"\"Debug 1: title:\" & msg.save_details.title","targetType":"jsonata","statusVal":"","statusType":"auto","x":1020,"y":160,"wires":[]},{"id":"377fb634af59c3fa","type":"split","z":"9a86d59e88442f2c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":220,"wires":[["7b21bb9c815f61ef"]]},{"id":"9e139c96772f9582","type":"http request","z":"9a86d59e88442f2c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://google.com","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":1050,"y":220,"wires":[["c651b52621a1c3d4"]]},{"id":"b7a7fc71bc9eb7cc","type":"change","z":"9a86d59e88442f2c","name":"save details","rules":[{"t":"set","p":"save_details","pt":"msg","to":"payload","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":220,"wires":[["fc962674bf19f1e9","9e139c96772f9582"]]},{"id":"c651b52621a1c3d4","type":"debug","z":"9a86d59e88442f2c","name":"Debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"\"Debug 2: title:\" & msg.save_details.title","targetType":"jsonata","statusVal":"","statusType":"auto","x":1220,"y":220,"wires":[]},{"id":"7b21bb9c815f61ef","type":"delay","z":"9a86d59e88442f2c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":700,"y":220,"wires":[["b7a7fc71bc9eb7cc"]]}]
This has problems as if I want it to be relliable, I need a sufficient delay which is drastically slowing down my flow.
Is there any better solution to insure that the http-request is performed in an "atomic" way ?
Thanks