For any item that passes the switch, I need Last Op to run after First Op is finished, however First Op is run asynchronously. Further I don't want First Op to be run multiple times for items are the same time. Here's the flow using delay, which I think does what I want wrt 1) and 3):
[{"id":"9a0c6b97.307988","type":"function","z":"87b395b1.644fe8","name":"Get list of archives to be created","func":"\nreturn {payload: [0,1,2,3]}","outputs":1,"noerr":0,"x":390,"y":200,"wires":[["505586ec.479828","d1061ae4.300828"]]},{"id":"bf920944.9c6128","type":"inject","z":"87b395b1.644fe8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":200,"wires":[["9a0c6b97.307988"]]},{"id":"505586ec.479828","type":"split","z":"87b395b1.644fe8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":630,"y":200,"wires":[["8a851cf.d6aace"]]},{"id":"8a851cf.d6aace","type":"switch","z":"87b395b1.644fe8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":200,"wires":[["3d0c47ff.8e8b38","2d0f351d.5321aa"]]},{"id":"7caf7849.2856a8","type":"function","z":"87b395b1.644fe8","name":"Slow Async Webservice","func":"\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":280,"wires":[["76dde637.20c708"]]},{"id":"4e3a3e2f.eb79f","type":"function","z":"87b395b1.644fe8","name":"Transfer Created Archive ","func":"\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":280,"wires":[["481d15d0.1d7a7c"]]},{"id":"3d0c47ff.8e8b38","type":"debug","z":"87b395b1.644fe8","name":"Print qualifying item","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":140,"wires":[]},{"id":"481d15d0.1d7a7c","type":"debug","z":"87b395b1.644fe8","name":"Item Processed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":960,"y":200,"wires":[]},{"id":"76dde637.20c708","type":"delay","z":"87b395b1.644fe8","name":"Wait 2s for service to finish","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":280,"wires":[["4e3a3e2f.eb79f"]]},{"id":"2d0f351d.5321aa","type":"delay","z":"87b395b1.644fe8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":180,"y":280,"wires":[["7caf7849.2856a8"]]},{"id":"d1061ae4.300828","type":"delay","z":"87b395b1.644fe8","name":"Wait 1m for all items to process","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":80,"wires":[["1fb5fcac.51cba3"]]},{"id":"1fb5fcac.51cba3","type":"function","z":"87b395b1.644fe8","name":"Finalise batch job","func":"\nreturn {payload: [0,1,2,3]}","outputs":1,"noerr":0,"x":590,"y":80,"wires":[["83915c40.9a34d"]]},{"id":"83915c40.9a34d","type":"debug","z":"87b395b1.644fe8","name":"Done","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":80,"wires":[]}]
I don't like that I have to guess how long to wait before finalising the batch job though. Is there any way for the last processed item to trigger that flow?
In programming parlance I'm looking for the equivalent serial for each loop I suppose?