I have a flow in which there are nearly 20 messages coming from a node and i split them to process individually so i set a rate limit of approx 20 seconds. however, some messages are empty, and hence dont take any amount of time, so i need to wait for 20 seconds unnecessarily,
hence i added a msg.flush set to 1, to advance to next message immediately, the trouble is, the msg.flush itself adds a message into the queue, and although till the end of the original message length the flow works at best speed possible, the rate limit continues to send out the message recieved from msg.flush and the flow gives error as it does not have expected key parameters in the message.
i now have optimised by including a switch node that looks for a key parameter and stops flow if not recieved.
is there a better method.
Note : injecting msg.flush from an inject node without any payload works perfectly. i tried deleting the message property before msg.flush, but there are so many properties, it is difficult to delete all of them (is there a *.*
delete for this step?)
[{"id":"76b8bd875937cd50","type":"group","z":"114ac201cf643935","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["8dddce38c5ba775f","a6486c81eb4a409c","f24eaf38e8d2b698","90a3c38879e4403f","dc7b1a312f68ac14","567058326adf6d55","f04246036fe31be2","5c58f9430337ea1f","056248a6508b9eee","6fff3809badcd06c","ed46dca5f1f7bf03","7b688b20f13efa15","87c6c5c32d271be5"],"x":194,"y":179,"w":832,"h":322},{"id":"8dddce38c5ba775f","type":"inject","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"topic1","payload":"{\"item\":\"one\",\"item-2\":\"two\",\"item-3\":\"three\",\"item-4\":\"four\",\"item-5\":\"five\"}","payloadType":"json","x":290,"y":220,"wires":[["a6486c81eb4a409c","f24eaf38e8d2b698"]]},{"id":"a6486c81eb4a409c","type":"debug","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"debug 2822","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"msg","x":910,"y":220,"wires":[]},{"id":"f24eaf38e8d2b698","type":"junction","z":"114ac201cf643935","g":"76b8bd875937cd50","x":380,"y":280,"wires":[["90a3c38879e4403f"]]},{"id":"90a3c38879e4403f","type":"split","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","property":"payload","x":690,"y":280,"wires":[["dc7b1a312f68ac14","567058326adf6d55"]]},{"id":"dc7b1a312f68ac14","type":"debug","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"debug 2823","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":910,"y":280,"wires":[]},{"id":"567058326adf6d55","type":"delay","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":720,"y":340,"wires":[["6fff3809badcd06c"]]},{"id":"f04246036fe31be2","type":"change","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"Flush 1","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"flush","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":340,"wires":[["567058326adf6d55"]]},{"id":"5c58f9430337ea1f","type":"change","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":460,"wires":[["567058326adf6d55"]]},{"id":"056248a6508b9eee","type":"change","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"Flush All","rules":[{"t":"set","p":"flush","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":400,"wires":[["567058326adf6d55"]]},{"id":"6fff3809badcd06c","type":"debug","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"debug 2824","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"msg","x":910,"y":340,"wires":[]},{"id":"ed46dca5f1f7bf03","type":"inject","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hello","payloadType":"str","x":290,"y":340,"wires":[["f04246036fe31be2"]]},{"id":"7b688b20f13efa15","type":"inject","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":460,"wires":[["5c58f9430337ea1f"]]},{"id":"87c6c5c32d271be5","type":"inject","z":"114ac201cf643935","g":"76b8bd875937cd50","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":400,"wires":[["056248a6508b9eee"]]}]
in the attached example, the inject node with a payload 'hello' simulates my exact flow, but with more number of properties. injecting the 'hello' payload doesn't add to the queue, since i have a delete msg.payload before msg.flush in the change node.