Simple Retry

The presented Node-RED flow demonstrates the successful integration of the Retry Cloud Pattern to enhance the reliability and fault tolerance of cloud-based applications. By incorporating retry strategies within the flow, transient failures can be effectively managed, ensuring the seamless operation of cloud-based systems. This implementation serves as a valuable example for developers seeking to leverage Node-RED in the design of robust and resilient cloud architectures.

[{"id":"e976c9069888c66c","type":"subflow","name":"Simple Retry","info":"","category":"","in":[{"x":140,"y":120,"wires":[{"id":"50b54310bc44b2ce"}]}],"out":[{"x":1320,"y":120,"wires":[{"id":"3eb4ec6b71fc383b","port":0},{"id":"bad4bdb7e00b7a80","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"50b54310bc44b2ce","type":"function","z":"e976c9069888c66c","name":"","func":"msg.delay = msg.retry_interval;\nmsg.retry_counter = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":120,"wires":[["b4eca1de14599dd1"]]},{"id":"b4eca1de14599dd1","type":"delay","z":"e976c9069888c66c","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":440,"y":120,"wires":[["96ca1ed69e7fa7ac"]]},{"id":"96ca1ed69e7fa7ac","type":"http request","z":"e976c9069888c66c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":590,"y":120,"wires":[["4442b04b4a071572"]]},{"id":"3eb4ec6b71fc383b","type":"switch","z":"e976c9069888c66c","name":"if success","property":"statusCode","propertyType":"msg","rules":[{"t":"btwn","v":"200","vt":"num","v2":"299","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":940,"y":120,"wires":[[],["bad4bdb7e00b7a80"]]},{"id":"4442b04b4a071572","type":"function","z":"e976c9069888c66c","name":"counter increment","func":"msg.retry_counter++;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":120,"wires":[["3eb4ec6b71fc383b"]]},{"id":"bad4bdb7e00b7a80","type":"switch","z":"e976c9069888c66c","name":"if max retries","property":"retry_counter","propertyType":"msg","rules":[{"t":"gte","v":"n_retries","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1110,"y":160,"wires":[[],["b4eca1de14599dd1","0fb09013857b9001"]]},{"id":"0fb09013857b9001","type":"debug","z":"e976c9069888c66c","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1320,"y":220,"wires":[]}]

Flow Info

Created 2 years, 5 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • delay (x1)
  • function (x2)
  • http request (x1)
  • switch (x2)
Other
  • subflow (x1)

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option