@gregoriusrippenstein/erlang-red-unittest 0.20.2 → 0.21.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/README.md +4 -2
  2. package/examples/.core/support JS hash naming in variable access.json +1 -0
  3. package/examples/.elixir/support basic module code.json +1 -0
  4. package/examples/.jsonata/$privdir operator.json +1 -0
  5. package/examples/.jsonata/$replace should be working for newlines.json +1 -0
  6. package/examples/.jsonata/$type operator.json +1 -0
  7. package/examples/.jsonata/ensure that $millis() works.json +1 -0
  8. package/examples/.jsonata/non-string key names.json +1 -0
  9. package/examples/.jsonata/split function.json +1 -0
  10. package/examples/.jsonata/support array definition.json +1 -0
  11. package/examples/assert values/ignores failures if requested and boolean not-equal test.json +1 -0
  12. package/examples/batch/basic behaviour.json +1 -0
  13. package/examples/binary/initial test.json +1 -0
  14. package/examples/binary/parse PNG image data.json +1 -0
  15. package/examples/captureio/Capture io from function node.json +1 -0
  16. package/examples/captureio/Mutliple captures.json +1 -0
  17. package/examples/captureio/capture io from gen_server behaviour.json +1 -0
  18. package/examples/captureio/collect io from event handlers.json +1 -0
  19. package/examples/captureio/collect io from state machine node.json +1 -0
  20. package/examples/catch/catch all exceptions in a single group.json +1 -0
  21. package/examples/catch/catch all in group except those handler elsewhere.json +1 -0
  22. package/examples/catch/deal with it yourself.json +1 -0
  23. package/examples/catch/don't catch if the node isn't selected.json +1 -0
  24. package/examples/change/debug message if no catch node.json +1 -0
  25. package/examples/change/set functionality.json +1 -0
  26. package/examples/change/support buffer type.json +1 -0
  27. package/examples/change/support num types.json +1 -0
  28. package/examples/change/support underscores in binary, hex & octal values.json +1 -0
  29. package/examples/clientcode/Client code node test.json +1 -0
  30. package/examples/complete/avoid endless recursion.json +1 -0
  31. package/examples/complete/avoid recursion - test case 2.json +1 -0
  32. package/examples/complete/its complete nodes all the way down.json +1 -0
  33. package/examples/complete/split node.json +1 -0
  34. package/examples/complete/when is a join complete.json +1 -0
  35. package/examples/csv-decode/comma separated, parse numbers & msg per row.json +1 -0
  36. package/examples/csv-decode/separators other than comma.json +1 -0
  37. package/examples/csv-decode/single message for entire CSV, comma, RFC4180.json +1 -0
  38. package/examples/csv-decode/single message per line.json +1 -0
  39. package/examples/csv-decode/skip line happens before parsing content.json +1 -0
  40. package/examples/csv-encode/line termination and separator.json +1 -0
  41. package/examples/csv-encode/simple object.json +1 -0
  42. package/examples/debug/Jsonata expressions in output field.json +1 -0
  43. package/examples/debug/ensure debug messages are generated.json +1 -0
  44. package/examples/debug/handle largish json files as content.json +1 -0
  45. package/examples/debug/only debug specific property.json +1 -0
  46. package/examples/debug/status message counter.json +1 -0
  47. package/examples/debug/type hadling of JSONata results (ered).json +1 -0
  48. package/examples/debug/type hadling of JSONata results (node-red).json +1 -0
  49. package/examples/delay/delay messages by 5 seconds.json +1 -0
  50. package/examples/delay/delay multiple message for the same length of time.json +1 -0
  51. package/examples/delay/need to provide a status message of queue size.json +1 -0
  52. package/examples/delay/respect the reset flag and dont pass on the reset msg.json +1 -0
  53. package/examples/eventhandler/handle kill exits.json +1 -0
  54. package/examples/eventhandler/handle normal exits.json +1 -0
  55. package/examples/eventhandler/multiple dynamic event handlers.json +1 -0
  56. package/examples/eventhandler/register and unregister handler.json +1 -0
  57. package/examples/eventhandler/static configuration.json +1 -0
  58. package/examples/eventhandler/static handler with arguments.json +1 -0
  59. package/examples/eventhandler/static handler: multiple instances.json +1 -0
  60. package/examples/eventhandler/used with a supervisor node.json +1 -0
  61. package/examples/exec/async with noisy command.json +1 -0
  62. package/examples/exec/empty commands are not supported.json +1 -0
  63. package/examples/exec/generate complete msg once command is done.json +1 -0
  64. package/examples/exec/handle multiple process at once (ered).json +1 -0
  65. package/examples/exec/handle multiple process at once (nred).json +1 -0
  66. package/examples/exec/support timeout specification (ered).json +1 -0
  67. package/examples/exec/support timeout specification (nred).json +1 -0
  68. package/examples/exec/synchronised execution (ered).json +1 -0
  69. package/examples/exec/synchronised execution (nred).json +1 -0
  70. package/examples/file in/basic functionality of being able to read a file.json +1 -0
  71. package/examples/file in/error when file not found.json +1 -0
  72. package/examples/file in/warning if no file name is defined.json +1 -0
  73. package/examples/file in/will accept file name from msg obj.json +1 -0
  74. package/examples/filter/ignore initial value per topic.json +1 -0
  75. package/examples/filter/ignore initial value.json +1 -0
  76. package/examples/filter/post if value changed.json +1 -0
  77. package/examples/flowhubpull/retrieve flow id.json +1 -0
  78. package/examples/function/divide by zero throws kills node.json +1 -0
  79. package/examples/function/ensure /"on stop/" code is executed.json" +1 -0
  80. package/examples/function/function and module work together.json +1 -0
  81. package/examples/function/handle corrupt code.json +1 -0
  82. package/examples/function/return values are important.json +1 -0
  83. package/examples/function/set node context.json +1 -0
  84. package/examples/function/speaks Erlang.json +1 -0
  85. package/examples/function/supervisor interaction.json +1 -0
  86. package/examples/function/support multiple outputs.json +1 -0
  87. package/examples/function/support not returning a message.json +1 -0
  88. package/examples/function/support timeout setting.json +1 -0
  89. package/examples/function/supports completed node.json +1 -0
  90. package/examples/genserver/addressing modules.json +1 -0
  91. package/examples/genserver/triggering functionality.json +1 -0
  92. package/examples/http/Dynamic Routing.json +1 -0
  93. package/examples/http/POST & GET have different endpoints.json +1 -0
  94. package/examples/http/dynamic redirect.json +1 -0
  95. package/examples/http/have params in the path.json +1 -0
  96. package/examples/http/http static routing.json +1 -0
  97. package/examples/http/multiple endpoints don't all get the request.json +1 -0
  98. package/examples/http/nodes should be able to handle requests.json +1 -0
  99. package/examples/http/post requests - json content.json +1 -0
  100. package/examples/http/request parses JSON conent.json +1 -0
  101. package/examples/http/request, ensure url and method are handled.json +1 -0
  102. package/examples/http/set content type.json +1 -0
  103. package/examples/http/support query string on get request.json +1 -0
  104. package/examples/inject/repeat interval.json +1 -0
  105. package/examples/inject/support octal, binary & hex underscore values.json +1 -0
  106. package/examples/inject/trigger after - does not trigger.json +1 -0
  107. package/examples/inject/unsupported JSONata function.json +1 -0
  108. package/examples/join/manual config with count & nested property name.json +1 -0
  109. package/examples/json/parse example json content.json +1 -0
  110. package/examples/json/raise exception if content not valid.json +1 -0
  111. package/examples/json/support prettify json content.json +1 -0
  112. package/examples/link nodes/across flow tabs.json +1 -0
  113. package/examples/link nodes/cascading link calls.json +1 -0
  114. package/examples/markdown/allow for inline html.json +1 -0
  115. package/examples/markdown/convert markdown to html.json +1 -0
  116. package/examples/markdown/support code block.json +1 -0
  117. package/examples/module/Using with Statemachine.json +1 -0
  118. package/examples/module/Using with function node.json +1 -0
  119. package/examples/mqtt/auto-(re)connect.json +1 -0
  120. package/examples/noop/Noop node will error out.json +1 -0
  121. package/examples/process/Can send messages.json +1 -0
  122. package/examples/range/basic examples.json +1 -0
  123. package/examples/split/Array type.json +1 -0
  124. package/examples/split/binary type.json +1 -0
  125. package/examples/split/using strings and buffers.json +1 -0
  126. package/examples/split/work with binary data as string data (ered).json +1 -0
  127. package/examples/split/work with binary data as string data (nred).json +1 -0
  128. package/examples/statemachine/Representing gen_statem in Erlang-Red.json +1 -0
  129. package/examples/statemachine/combined with supervisor.json +1 -0
  130. package/examples/statemachine/exception if no action to perform.json +1 -0
  131. package/examples/status/basic working version.json +1 -0
  132. package/examples/status/only one message per status value.json +1 -0
  133. package/examples/status/source map inside the status map.json +1 -0
  134. package/examples/supervisor/inform user if config needs updating.json +1 -0
  135. package/examples/supervisor/multiple individual supervisors.json +1 -0
  136. package/examples/supervisor/order defined by Y coordinate..json +1 -0
  137. package/examples/supervisor/restart after exit call.json +1 -0
  138. package/examples/supervisor/supervising two function nodes.json +1 -0
  139. package/examples/supervisor/supervisor loops.json +1 -0
  140. package/examples/supervisor/supervisor of supervisor of supervisor of .....json +1 -0
  141. package/examples/supervisor/supervisor told to stop.json +1 -0
  142. package/examples/supervisor/supervisor tree.json +1 -0
  143. package/examples/supervisor/two supervisors cannot supervise the same nodes.json +1 -0
  144. package/examples/supervisor/unsupported configrations.json +1 -0
  145. package/examples/switch/JSONata undefined value & exceptions.json +1 -0
  146. package/examples/switch/post debug on JSONata exception.json +1 -0
  147. package/examples/switch/raise exception if JSONata has exception.json +1 -0
  148. package/examples/tcp/Bad value on output port (3425).json +1 -0
  149. package/examples/tcp/multiple tcp in connectors (1194).json +1 -0
  150. package/examples/tcp/request node - disconnect immediately (1001).json +1 -0
  151. package/examples/tcp/tcp-out node in reply mode (1202).json +1 -0
  152. package/examples/tcp/transfer string between nodes (1201).json +1 -0
  153. package/examples/template/handle base64 encoded data.json +1 -0
  154. package/examples/template/support mustache template.json +1 -0
  155. package/examples/trigger/initial example.json +1 -0
  156. package/nodes/ut-assert-debug.js +305 -19
  157. package/nodes/ut-assert-values.js +179 -161
  158. package/package.json +3 -2
  159. package/plugins/sidebar.html +99 -55
  160. package/priv/testdata/helloworld.txt +1 -0
  161. package/{examples/9e7ccc97f80d9afb/flows.json → priv/testdata/test.json} +53 -20
  162. package/examples/069552b2eb6bce48/flows.json +0 -265
  163. package/examples/08183069b5f8ef9c/flows.json +0 -156
  164. package/examples/084fb0fc954b7156/flows.json +0 -132
  165. package/examples/090eb2d5d71fd45f/flows.json +0 -158
  166. package/examples/0c35d269ca7178c6/flows.json +0 -443
  167. package/examples/0cc95e44532c14ec/flows.json +0 -94
  168. package/examples/0e54563ba63b1501/flows.json +0 -1
  169. package/examples/16b0bc0cdb0c5807/flows.json +0 -1
  170. package/examples/16b254125478329a/flows.json +0 -114
  171. package/examples/182731f54d855071/flows.json +0 -52
  172. package/examples/1ace9e051618db79/flows.json +0 -125
  173. package/examples/1c1d2cb981cf9f01/flows.json +0 -120
  174. package/examples/1db9c9a1b92e0263/flows.json +0 -172
  175. package/examples/20eeaf41372f7b17/flows.json +0 -62
  176. package/examples/27804627fb8f56bd/flows.json +0 -178
  177. package/examples/2a2c508260b96236/flows.json +0 -141
  178. package/examples/34f859d75b76d03c/flows.json +0 -200
  179. package/examples/36846ad6698e1bc0/flows.json +0 -163
  180. package/examples/3be6bc074c7647bd/flows.json +0 -319
  181. package/examples/44f12f6e4a455084/flows.json +0 -272
  182. package/examples/45209c67f865ce73/flows.json +0 -1
  183. package/examples/4657dbc0aa4a97bb/flows.json +0 -268
  184. package/examples/47514a335b4cd67e/flows.json +0 -362
  185. package/examples/486c1412721bb241/flows.json +0 -525
  186. package/examples/51bfa9456b1745c0/flows.json +0 -639
  187. package/examples/538be5947c639b32/flows.json +0 -75
  188. package/examples/545871d31c3f5f3f/flows.json +0 -376
  189. package/examples/55f105cfd894b06c/flows.json +0 -121
  190. package/examples/57d44c342a1f00e2/flows.json +0 -1
  191. package/examples/597ee2a683d9908f/flows.json +0 -129
  192. package/examples/59da63b5adb460db/flows.json +0 -188
  193. package/examples/61142eb3e4e54eab/flows.json +0 -536
  194. package/examples/64445798b59d2630/flows.json +0 -257
  195. package/examples/6d46e3fe1f2245b8/flows.json +0 -86
  196. package/examples/6dd3a5754f83dc2e/flows.json +0 -232
  197. package/examples/6ff45e2a0ce77393/flows.json +0 -131
  198. package/examples/700c94899fdd3334/flows.json +0 -107
  199. package/examples/7581c2be261f9c17/flows.json +0 -1874
  200. package/examples/7ecfd18f58fc6510/flows.json +0 -1
  201. package/examples/7fea9696f6186962/flows.json +0 -141
  202. package/examples/80655e5d4035fa71/flows.json +0 -215
  203. package/examples/8421f37b6c40e1ec/flows.json +0 -1
  204. package/examples/866410b56fa42447/flows.json +0 -1076
  205. package/examples/89aeaeef64509bed/flows.json +0 -101
  206. package/examples/8a627c9bfe3b4aff/flows.json +0 -552
  207. package/examples/96f6f83dcab507e5/flows.json +0 -105
  208. package/examples/9746601768c3b3b6/flows.json +0 -93
  209. package/examples/9942fa1aeb1b2428/flows.json +0 -2346
  210. package/examples/9b1023c95a2613cc/flows.json +0 -141
  211. package/examples/9d11bfc3a6d88535/flows.json +0 -301
  212. package/examples/9f0d6c3ad7798a77/flows.json +0 -142
  213. package/examples/9f7351d7a7304584/flows.json +0 -83
  214. package/examples/a123cd431f1967cd/flows.json +0 -1757
  215. package/examples/a4c9cabf4b335488/flows.json +0 -86
  216. package/examples/a916165378c446e3/flows.json +0 -240
  217. package/examples/ae38b2dbd23d1681/flows.json +0 -3089
  218. package/examples/ae8a9b0bbbaff447/flows.json +0 -271
  219. package/examples/b07b511dc8bb8339/flows.json +0 -92
  220. package/examples/b1501de32c769cf2/flows.json +0 -94
  221. package/examples/b5fbcdbffb568569/flows.json +0 -1
  222. package/examples/b723353a316fa50e/flows.json +0 -1
  223. package/examples/b864b3e3510cd120/flows.json +0 -205
  224. package/examples/bdbe94d065f3b3a6/flows.json +0 -143
  225. package/examples/bfced61e72c69715/flows.json +0 -616
  226. package/examples/c0b1cf6656eac77f/flows.json +0 -518
  227. package/examples/c381b5135cc947cd/flows.json +0 -272
  228. package/examples/c4690c0a085d6ef5/flows.json +0 -145
  229. package/examples/c5f513bc380bc30a/flows.json +0 -696
  230. package/examples/cfa8595b2e2b8269/flows.json +0 -255
  231. package/examples/d17fb2553fe8013a/flows.json +0 -157
  232. package/examples/d61182e87a604efa/flows.json +0 -340
  233. package/examples/eb24c92ce5621760/flows.json +0 -141
  234. package/examples/eb447048178f6e16/flows.json +0 -201
  235. package/examples/eed68dbcecd1431f/flows.json +0 -204
  236. package/examples/ef61f644d5436dbe/flows.json +0 -1
  237. package/examples/f19fdae0c02b4f03/flows.json +0 -1008
  238. package/examples/f2f61ec9fc46a468/flows.json +0 -575
  239. package/examples/f346d45c81f595e5/flows.json +0 -501
  240. package/examples/f38603a59963386c/flows.json +0 -1
  241. package/examples/f5f82ca50317fda7/flows.json +0 -121
  242. package/examples/f946aafaebb1398d/flows.json +0 -135
  243. package/examples/f94db507552f4934/flows.json +0 -165
  244. package/examples/fb50bac16667fc54/flows.json +0 -364
  245. /package/examples/{684b9066e98b9722/flows.json → .core/Disabled node should not be sent messages.json} +0 -0
  246. /package/examples/{7b77600dcf78933f/flows.json → .core/attribute parsing.json} +0 -0
  247. /package/examples/{93c6e969dcf84e70/flows.json → .core/ensure that message ids don't change.json} +0 -0
  248. /package/examples/{d206746f9f2594a6/flows.json → .jsonata/$match operator.json} +0 -0
  249. /package/examples/{37883612d913fd66/flows.json → .jsonata/$not operator.json} +0 -0
  250. /package/examples/{caccb020fce3f485/flows.json → .jsonata/$pad function.json} +0 -0
  251. /package/examples/{a862ae412a70ded1/flows.json → .jsonata/$substring functionality.json} +0 -0
  252. /package/examples/{0b299a3175fc0df1/flows.json → .jsonata/array indexing both forwards and backwards.json} +0 -0
  253. /package/examples/{2037454a5ee0d6c3/flows.json → .jsonata/basic support for JSONata.json} +0 -0
  254. /package/examples/{3e9e526b992d4c48/flows.json → .jsonata/ensure random is seeded.json} +0 -0
  255. /package/examples/{e7184b7ca4f07907/flows.json → .jsonata/sum arrays of objects.json} +0 -0
  256. /package/examples/{218350f2e240a15d/flows.json → .jsonata/support $keys function.json} +0 -0
  257. /package/examples/{b50f775ae3b74d38/flows.json → .jsonata/testing the modulo operator.json} +0 -0
  258. /package/examples/{1658196c31549916/flows.json → batch/batch until batch is full.json} +0 -0
  259. /package/examples/{c843dacf753a19d8/flows.json → batch/ensure batch size of 1 works.json} +0 -0
  260. /package/examples/{9a1bdfdcd7b2be8e/flows.json → batch/performance.json} +0 -0
  261. /package/examples/{538d2f4704cd2eca/flows.json → catch/ensure source is inside error map.json} +0 -0
  262. /package/examples/{6a9ffd45c418497b/flows.json → catch/file not found exception.json} +0 -0
  263. /package/examples/{71f65246c742cfc9/flows.json → catch/multiple nodes in one flow is possible.json} +0 -0
  264. /package/examples/{ed621e03921c13de/flows.json → catch/uncaught catch - part 2 - work.json} +0 -0
  265. /package/examples/{f5bdafa844f6d280/flows.json → catch/uncaught catches.json} +0 -0
  266. /package/examples/{9c51a179141515b2/flows.json → change/change functionality.json} +0 -0
  267. /package/examples/{ea246f68766c8630/flows.json → change/delete functionality.json} +0 -0
  268. /package/examples/{30465efe017cc9b0/flows.json → change/delete nested keys.json} +0 -0
  269. /package/examples/{ced70c769db825eb/flows.json → change/ensure rules are expected in order.json} +0 -0
  270. /package/examples/{7dae2b1a7881c607/flows.json → change/move functionality.json} +0 -0
  271. /package/examples/{92054e0dd22f14c6/flows.json → change/raises an exception if JSONata has exception.json} +0 -0
  272. /package/examples/{b85795a24882502b/flows.json → change/set support nested properties.json} +0 -0
  273. /package/examples/{c28048d859db3773/flows.json → change/support boolean types.json} +0 -0
  274. /package/examples/{12572f9ac11e1786/flows.json → change/support json values in the set.json} +0 -0
  275. /package/examples/{def45a46c8f4da72/flows.json → change/support nested array indicies - setting & getting & deleting.json} +0 -0
  276. /package/examples/{0cb8971e5f88ed1e/flows.json → change/support nested keys on the set operation.json} +0 -0
  277. /package/examples/{48d9fdcde317974e/flows.json → change/support timestamp type.json} +0 -0
  278. /package/examples/{1bac0a78e0a36ec0/flows.json → comment/what is there to test-.json} +0 -0
  279. /package/examples/{b9cd19107a5145c4/flows.json → complete/disabled nodes don't receive.json} +0 -0
  280. /package/examples/{5e07acf2da13b504/flows.json → complete/ensure the altered msg object is sent.json} +0 -0
  281. /package/examples/{01b074cfa6ae8818/flows.json → complete/link nodes.json} +0 -0
  282. /package/examples/{cd44a688eb2ab3cf/flows.json → complete/messags from unconnected inject.json} +0 -0
  283. /package/examples/{30c79fc42a5c35eb/flows.json → complete/only handle messages from listened to nodes.json} +0 -0
  284. /package/examples/{f8727464c799eb22/flows.json → complete/switch node isn't compatible with complete.json} +0 -0
  285. /package/examples/{b2a67e301fabab0e/flows.json → debug/handle the button press to active and deactive debug output.json} +0 -0
  286. /package/examples/{a6dc7002d0a8640e/flows.json → debug/if not active, no debug message in panel.json} +0 -0
  287. /package/examples/{b1463d7bbf545725/flows.json → debug/inactive debug nodes still count messages.json} +0 -0
  288. /package/examples/{5a06352874fa379d/flows.json → debug/only send debug message to server console if asked to.json} +0 -0
  289. /package/examples/{c1370220fd37968e/flows.json → delay/ignore msg.delay if its not set.json} +0 -0
  290. /package/examples/{d17062b01c4a9435/flows.json → delay/random between two values.json} +0 -0
  291. /package/examples/{3ea113b4ec3b6e5e/flows.json → delay/set delay via msg.delay.json} +0 -0
  292. /package/examples/{e2a801d2b3e2143f/flows.json → exec/add payload and append arguments.json} +0 -0
  293. /package/examples/{b98d0b05a760ad79/flows.json → exec/execute simple command.json} +0 -0
  294. /package/examples/{6ea4c6b373eeaa8d/flows.json → filter/narrowband no topic.json} +0 -0
  295. /package/examples/{cef9dd7dc179b8b3/flows.json → filter/value differ by topic.json} +0 -0
  296. /package/examples/{b2fcc5806b2715c0/flows.json → inject/JSONata undefined value & exceptions.json} +0 -0
  297. /package/examples/{09aab59a2455cf15/flows.json → inject/Payload, topic and fubar set on inject.json} +0 -0
  298. /package/examples/{8180ae5891c673de/flows.json → inject/ensure that topic is set correctly.json} +0 -0
  299. /package/examples/{1eb35963b752eca9/flows.json → inject/json support for properties other than payload.json} +0 -0
  300. /package/examples/{61847d719e50f83f/flows.json → inject/jsonata support for both payload and other properties.json} +0 -0
  301. /package/examples/{459322e0f8e0b785/flows.json → inject/nested hash & array support.json} +0 -0
  302. /package/examples/{c163c627bd2a37c7/flows.json → inject/support boolean type.json} +0 -0
  303. /package/examples/{7e1d04570c6bdff9/flows.json → inject/support jsonata for topic values.json} +0 -0
  304. /package/examples/{1a196bce3e57f5c1/flows.json → inject/support nested property names.json} +0 -0
  305. /package/examples/{2a12af161b544aa1/flows.json → inject/support num types.json} +0 -0
  306. /package/examples/{ec921769b3c24fb6/flows.json → inject/support the msg property type.json} +0 -0
  307. /package/examples/{9ff2e8ab21d922c5/flows.json → inject/trigger once - default value.json} +0 -0
  308. /package/examples/{1d3326a724ecbea0/flows.json → join/automatic mode.json} +0 -0
  309. /package/examples/{24f35eaa8656755f/flows.json → join/count overrides parts, complete overrides count.json} +0 -0
  310. /package/examples/{987cd33b9cda8529/flows.json → join/manual configration with count and property name.json} +0 -0
  311. /package/examples/{50d5679818477b66/flows.json → join/manual configuration counting messages.json} +0 -0
  312. /package/examples/{894f6e38bfd1aca6/flows.json → join/remove parts once matched.json} +0 -0
  313. /package/examples/{5cf6aec7d688fce4/flows.json → join/results are not ordered by index.json} +0 -0
  314. /package/examples/{d5424657b497d5af/flows.json → join/useparts with count value.json} +0 -0
  315. /package/examples/{77854a5ea962257b/flows.json → join/useparts without count value.json} +0 -0
  316. /package/examples/{f1e71f2ccb34fd6e/flows.json → join/wait for complete until messages are sent.json} +0 -0
  317. /package/examples/{d4ce58359ff6ff96/flows.json → join/with parts until complete received.json} +0 -0
  318. /package/examples/{b3f365d0b7d1f97d/flows.json → json/overwrite the attribute.json} +0 -0
  319. /package/examples/{e1ced3b16782f7c8/flows.json → junction/should just pass on the message.json} +0 -0
  320. /package/examples/{51870a76d1aaf67a/flows.json → link nodes/_linkSource support.json} +0 -0
  321. /package/examples/{bbb1fc2d47c3cd5f/flows.json → link nodes/basic test whether out and in can connect.json} +0 -0
  322. /package/examples/{15c2fad089960984/flows.json → link nodes/dynamic targets and timeout.json} +0 -0
  323. /package/examples/{c274a07715a87ca4/flows.json → link nodes/exception if dynamic link does not exist.json} +0 -0
  324. /package/examples/{9463eba0ab843567/flows.json → link nodes/exception if multiple link nodes match.json} +0 -0
  325. /package/examples/{641ddaab2819c61d/flows.json → link nodes/flow for call and returning.json} +0 -0
  326. /package/examples/{b6d4e4592b27a344/flows.json → link nodes/implement time out on link call node.json} +0 -0
  327. /package/examples/{c6ee6e89a51c98fc/flows.json → link nodes/link call - return to sender.json} +0 -0
  328. /package/examples/{38616d22e1569aa5/flows.json → link nodes/link call to a dynamic link in node - by name.json} +0 -0
  329. /package/examples/{5433b57035d597f9/flows.json → link nodes/link call to a dynamic link in node - by node id.json} +0 -0
  330. /package/examples/{213803d61ecfde3a/flows.json → link nodes/mutliple links.json} +0 -0
  331. /package/examples/{b7ebaf91f4d66ab3/flows.json → sort/array of objects.json} +0 -0
  332. /package/examples/{cffa610c817beb43/flows.json → sort/msg.complete is not respected.json} +0 -0
  333. /package/examples/{5f6929bb3374b782/flows.json → sort/sort by parts.index.json} +0 -0
  334. /package/examples/{b1430ea37ba7cc19/flows.json → split/array split.json} +0 -0
  335. /package/examples/{4de34883c5d93dc3/flows.json → split/len value is the array split size.json} +0 -0
  336. /package/examples/{2c59ef974b2523ba/flows.json → split/nested parts.json} +0 -0
  337. /package/examples/{02b18fc0ed9de178/flows.json → split/parts id is identical.json} +0 -0
  338. /package/examples/{435d3b48dd0f462c/flows.json → split/silently ignore integer as a value to split.json} +0 -0
  339. /package/examples/{5cd133958df17529/flows.json → switch/catch all v. stop after first.json} +0 -0
  340. /package/examples/{562c518969666f24/flows.json → switch/empty, non-empty, null & not-null operators.json} +0 -0
  341. /package/examples/{3edda6bd788f88c2/flows.json → switch/ensure JSONata support.json} +0 -0
  342. /package/examples/{2c1c291ec8466bfb/flows.json → switch/handle is true & is false.json} +0 -0
  343. /package/examples/{59aa8a866d8d7a70/flows.json → switch/handle nested values.json} +0 -0
  344. /package/examples/{def56742e02f6a75/flows.json → switch/property is not defined on msg object.json} +0 -0
  345. /package/examples/{f4c4a57e77439a1b/flows.json → switch/regular expression operator.json} +0 -0
  346. /package/examples/{ce2f98273da05245/flows.json → switch/support otherwise /"catchall/" rule.json"} +0 -0
  347. /package/examples/{0616f795a4aee63e/flows.json → switch/working JSONata expression operator.json} +0 -0
  348. /package/examples/{84a5a362cafe703f/flows.json → tcp/request node - stream of strings (1101).json} +0 -0
  349. /package/examples/{6f0dcbf18234c5e2/flows.json → tcp/tcp in node connect to (9393).json} +0 -0
  350. /package/examples/{2a95a7b40a798878/flows.json → tcp/telnet server (2323).json} +0 -0
  351. /package/examples/{698b83b8aeb5d5b6/flows.json → template/contains plain text and no mustache content.json} +0 -0
  352. /package/examples/{63ca9baf860d1d8f/flows.json → template/support Json encoding.json} +0 -0
  353. /package/examples/{3ed472eab9503b4f/flows.json → template/support logic in logicless mustache template.json} +0 -0
  354. /package/examples/{ad2bf1089481dcfb/flows.json → trigger/extend timer.json} +0 -0
  355. /package/examples/{8bc7412d6a4869c6/flows.json → trigger/loops of triggers.json} +0 -0
  356. /package/examples/{55f7fbe90e5befa8/flows.json → trigger/msg.delay overrides the configured delay.json} +0 -0
  357. /package/examples/{34d211e37618313c/flows.json → trigger/override via delay but no delay set.json} +0 -0
  358. /package/examples/{988f27b9abdde6e9/flows.json → trigger/send both messages on one pipe.json} +0 -0
  359. /package/examples/{338c5b411f4edfe8/flows.json → trigger/send first but not second message.json} +0 -0
  360. /package/examples/{5d4908af3d4f95e5/flows.json → trigger/send second message only.json} +0 -0
  361. /package/examples/{d595c53abba88f72/flows.json → trigger/the noop trigger.json} +0 -0
  362. /package/examples/{1566e453a88578a9/flows.json → trigger/two outputs.json} +0 -0
@@ -0,0 +1 @@
1
+ [{"id":"5672fa442b2b881d","type":"tab","label":"[statemachine] Representing gen_statem in Erlang-Red","disabled":false,"info":"## gen_statem behaviour\n\nErlang-Red won't be Erlang if it didn't know how to behave itself. This example shows how the [gen_statem](https://www.erlang.org/doc/apps/stdlib/gen_statem.html) behaviour can be visually implemented in Erlang-Red.\n\n## Setup\n\nSetting up a state machine requires defining a module for defining the behaviour of the state machine. For this test, the <a class=\"ahl-node-only\" data-ids=\"d27ff6b4cb3f4b16\">Module: pushbutton</a> is being used. It represents the [push pen button example](https://www.erlang.org/doc/apps/stdlib/gen_statem.html#module-pushbutton-code) from the documentation of the state machine.\n\nThe <a class=\"ahl-node-only\" data-ids=\"f2ebb3bf285716ac,d4fdb9f5a3792660\">state machine</a> nodes make reference to the module in their respective configurations. That defines the statemachines behaviour.\n\nWhen the statemachine receives a message from the one of the <a class=\"ahl-node-only\" data-ids=\"6d2bab8388444151,be3f533788078139,6ace31b4957dff44,d8856ed846ba27d0\">inject</a> nodes, it calls executes the follwing:\n\n```erlang\n#{payload := Action} = Msg,\nResult = gen_statem:call(Pid, binary_to_atom(Action)),\n```\n\nThe `payload` defines the action to perform and the result of the action is passed out as the payload on the outgoing message - if an outgoing message is generated.\n\n## Option: Send on state change\n\nThe difference between the two examples is that the <a class=\"ahl-group-only\" data-ids=\"5e10f2923ccf0b2a\">top one</a> only emits an outgoing message if the state has changed. This does not happen when `get_count` is triggered - it does not result in a state change so there is no outgoing message generated.\n\nThe <a class=\"ahl-group-only\" data-ids=\"3e05a4f2d46028bb\">bottom example</a> always emits outgoing messages, generating a message on every action.\n\nUsing this options allows the statemachine to act as a gateway. \n\n## Current state\n\nThe current state of the statemachine is always shown on the status of the node. \n\n## Other behaviours\n\n- [Supervisor](https://flows.red-erik.org/f/83c5e1824f32abec)\n- [Event Handler](https://flows.red-erik.org/f/b70a7ce34819e4d5)","env":[{"name":"ERED_PENDING","value":"false","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"5e10f2923ccf0b2a","type":"group","z":"5672fa442b2b881d","name":"only emit message on state change","style":{"label":true},"nodes":["f2ebb3bf285716ac","6d2bab8388444151","be3f533788078139","cb1f14a8e90433e9","aca422d93c92ee09","02bdd92d876da519"],"x":173,"y":242,"w":1061,"h":215},{"id":"f96f6bc60d58a481","type":"group","z":"5672fa442b2b881d","name":"common code used by all examples here","style":{"label":true},"nodes":["d27ff6b4cb3f4b16"],"x":173,"y":73,"w":265,"h":82},{"id":"3e05a4f2d46028bb","type":"group","z":"5672fa442b2b881d","name":"always emit messages","style":{"label":true},"nodes":["d4fdb9f5a3792660","6ace31b4957dff44","d8856ed846ba27d0","6f16fef44161a72e","f753306adf339932","3222b838d7e91c5f"],"x":178.5,"y":519,"w":1062,"h":215},{"id":"f2ebb3bf285716ac","type":"erlstatemachine","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"State machine - don't send on same state","scope":["d27ff6b4cb3f4b16"],"emit_on_state_change":true,"x":578,"y":348,"wires":[["cb1f14a8e90433e9"]]},{"id":"d27ff6b4cb3f4b16","type":"erlmodule","z":"5672fa442b2b881d","g":"f96f6bc60d58a481","name":"Module: pushbutton","module_name":"pushbutton","code":"%%\n%% Inspired by\n%% https://www.erlang.org/doc/apps/stdlib/gen_statem.html#module-pushbutton-code\n%%\n-module(pushbutton).\n-behaviour(gen_statem).\n\n-export([\n start/0,\n init/1,\n callback_mode/0,\n handle_event/4,\n code_change/4,\n terminate/3,\n stop/0\n]).\n\ncallback_mode() -> handle_event_function.\n\n-define(KEEP_STATE(ReplyWith),\n {keep_state, Data, [{reply, From, ReplyWith}]}\n).\n\nstart() ->\n gen_statem:start({local, ?MODULE}, ?MODULE, [], []).\n\nstop() ->\n gen_statem:stop(?MODULE).\nterminate(_Reason, _State, _Data) ->\n void.\ncode_change(_Vsn, State, Data, _Extra) ->\n {ok, State, Data}.\n\n%% Initial state and data\ninit([]) ->\n State = off, \n Data = 0,\n {ok,State,Data}.\n\n%%% state callback(s)\n\nhandle_event(\n {call, From},\n <<\"push\">>,\n off,\n Data\n) ->\n {next_state, on, Data + 1, [{reply, From, <<\"ok\">>}]};\n\nhandle_event(\n {call, From},\n <<\"push\">>,\n on,\n Data\n) ->\n {next_state, off, Data, [{reply, From, <<\"ok\">>}]};\n\nhandle_event(\n {call, From},\n <<\"get_count\">>,\n _CurrState,\n Data\n) ->\n {keep_state, Data, [{reply, From, Data}]};\n\n%%\n%% Fall through.\nhandle_event({call, From} = EventType, Stiff, State, Data) ->\n io:format(\"TEST (call): ~p ~p ~p ~p~n\",[EventType, Stiff, State, Data]),\n ?KEEP_STATE(<<\"not_allowed\">>);\n\nhandle_event(EventType, Stiff, State, Data) ->\n io:format(\"TEST : ~p ~p ~p ~p~n\",[EventType, Stiff, State, Data]),\n {keep_state, Data}.\n","x":289,"y":114,"wires":[]},{"id":"6d2bab8388444151","type":"inject","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":416,"wires":[["f2ebb3bf285716ac"]]},{"id":"be3f533788078139","type":"inject","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"get_count","props":[{"p":"action","v":"get_count","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":279,"y":283,"wires":[["f2ebb3bf285716ac"]]},{"id":"cb1f14a8e90433e9","type":"switch","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"","property":"_statem.action","propertyType":"msg","rules":[{"t":"eq","v":"push","vt":"str"},{"t":"eq","v":"get_count","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":895,"y":348,"wires":[["aca422d93c92ee09"],["02bdd92d876da519"]]},{"id":"aca422d93c92ee09","type":"ut-assert-success","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"","count":1,"x":1118,"y":318.5,"wires":[]},{"id":"02bdd92d876da519","type":"ut-assert-failure","z":"5672fa442b2b881d","g":"5e10f2923ccf0b2a","name":"","x":1119,"y":399.5,"wires":[]},{"id":"d4fdb9f5a3792660","type":"erlstatemachine","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"State machine - always send message","scope":["d27ff6b4cb3f4b16"],"emit_on_state_change":false,"x":573.5,"y":625,"wires":[["6f16fef44161a72e"]]},{"id":"6ace31b4957dff44","type":"inject","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":295.5,"y":693,"wires":[["d4fdb9f5a3792660"]]},{"id":"d8856ed846ba27d0","type":"inject","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"get_count","props":[{"p":"action","v":"get_count","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":284.5,"y":560,"wires":[["d4fdb9f5a3792660"]]},{"id":"6f16fef44161a72e","type":"switch","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"","property":"_statem.action","propertyType":"msg","rules":[{"t":"eq","v":"push","vt":"str"},{"t":"eq","v":"get_count","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":900.5,"y":625,"wires":[["f753306adf339932"],["3222b838d7e91c5f"]]},{"id":"f753306adf339932","type":"ut-assert-success","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"","count":1,"x":1123.5,"y":595.5,"wires":[]},{"id":"3222b838d7e91c5f","type":"ut-assert-success","z":"5672fa442b2b881d","g":"3e05a4f2d46028bb","name":"","count":1,"x":1124.5,"y":662,"wires":[]},{"id":"b5d03a7671459be0","type":"erlstatemachine","z":"5672fa442b2b881d","name":"State machine - always send message","scope":["d27ff6b4cb3f4b16"],"emit_on_state_change":false,"x":650,"y":1118,"wires":[["2abe81763b91b27d"]]},{"id":"0dbc97c4c78a1087","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1122,"wires":[["b5d03a7671459be0"]]},{"id":"dfe5684d8f93585c","type":"inject","z":"5672fa442b2b881d","name":"get_count","props":[{"p":"action","v":"get_count","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":172,"y":977,"wires":[["76bdd73f6bc070d6"]]},{"id":"2abe81763b91b27d","type":"switch","z":"5672fa442b2b881d","name":"","property":"_statem.action","propertyType":"msg","rules":[{"t":"eq","v":"push","vt":"str"},{"t":"eq","v":"get_count","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":924,"y":1118,"wires":[["c5911e86d175f6b0"],["2d86a90e19969d31","856803224f5b275c"]]},{"id":"c5911e86d175f6b0","type":"ut-assert-success","z":"5672fa442b2b881d","name":"","count":"6","x":1157,"y":1088.5,"wires":[]},{"id":"2d86a90e19969d31","type":"ut-assert-success","z":"5672fa442b2b881d","name":"","count":1,"x":1148,"y":1155,"wires":[]},{"id":"703ff051a8c1339b","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1159.2,"wires":[["b5d03a7671459be0"]]},{"id":"1c1fee931f376773","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1196.4,"wires":[["b5d03a7671459be0"]]},{"id":"eedb04d43399a5ac","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1233.6000000000001,"wires":[["b5d03a7671459be0"]]},{"id":"daee3833f6a73b08","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1270.8000000000002,"wires":[["b5d03a7671459be0"]]},{"id":"76bdd73f6bc070d6","type":"delay","z":"5672fa442b2b881d","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":355,"y":1047,"wires":[["b5d03a7671459be0"]]},{"id":"856803224f5b275c","type":"ut-assert-values","z":"5672fa442b2b881d","name":"","ignore_failure_if_succeed":false,"rules":[{"p":"payload","pt":"msg","t":"eql","to":"3","tot":"num"}],"x":1143,"y":1212.5,"wires":[[]]},{"id":"c43b8aea54216f87","type":"inject","z":"5672fa442b2b881d","name":"push","props":[{"p":"action","v":"push","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":233,"y":1308,"wires":[["b5d03a7671459be0"]]}]
@@ -0,0 +1 @@
1
+ [{"id":"c4b44f0eb78bc401","type":"tab","label":"[statemachine] combined with supervisor","disabled":false,"info":"## State & Super\n\nEnsure that state machines are compatiable with supervisors and that they behaviour correctly.\n\nThis includes:\n\n- handling cleaning up when the statemachine node is killed by a supervisor, i.e. killing the statemachine process --> <a class=\"ahl-group-only\" data-ids=\"3e66f8d35dcccd45\">test two</a>\n\n- being revived when the state machine dies, that is, state machine dies and the state machine node dies and the supervisor revives the state machine node and that should revive the state machein process.\n\n- one for one strategy --> <a class=\"ahl-group-only\" data-ids=\"08b624e4776271aa\">test one - state machine does not go down - one-for-one supervisor strategy</a> --> nothing happens to the <a class=\"ahl-node-only\" data-ids=\"8fe56bff6d1168df\">statemachine</a>.\n\n## Children Shutdown Modus\n\n**Important**: for the restart of state machine to work, in <a class=\"ahl-group-only\" data-ids=\"3e66f8d35dcccd45\">test two</a>, the supervisor children configuration **must** have shutdown method \"infinite timeout\". This allows the <a class=\"ahl-node-only\" data-ids=\"568af3c792b45e1c\">statemachine node</a> to shutdown the state machine process - cleaning up the BEAM. Why? Because a \"brutal kill\" cannot be trapped by a process.\n\n\n\n","env":[{"name":"ERED_TIMEOUT","value":"5","type":"num"},{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"08b624e4776271aa","type":"group","z":"c4b44f0eb78bc401","name":"test one - state machine does not go down - one-for-one supervisor strategy","style":{"label":true},"nodes":["20e72ff5bec936c8","40364d3053b8a4e0","bc4da59c2e1cb9bc","5d5ed051fcaa2ecb","5dd1a7202841bf5d","eb32759f57580b45","76eed69af6441b74","25b62620c84cb22a","66704de95c639175"],"x":114,"y":324.25,"w":1092,"h":334.5},{"id":"3e66f8d35dcccd45","type":"group","z":"c4b44f0eb78bc401","name":"test two - state machine goes down - one-for-all supervisor strategy - state machine killed by supervisor","style":{"label":true},"nodes":["10fc93b29d5a1f22","d70e1e108112879f","11eb87972a6a8401","00ceb0e4c309bcc0","bf5bf62875acb4d1","e86c227ffa1a83c1","57691c2b624686d6","dc5aaefd109f64b8","5c1cf21f1fb90b33","1861361a9b4d5f62"],"x":112,"y":667,"w":1141,"h":351.5},{"id":"d2676ea9167d324a","type":"group","z":"c4b44f0eb78bc401","name":"test three - the supervisor is supervising the statemachine and the function and the statemachine fails.","style":{"label":true},"nodes":["c3f4e859ea635735","ab9e3c02f592be5f","a7096bb288094a00","138da3cc8b3a5ef2","d67a25d2557a1e2e","9cbbda083db5e174","e722e21ca68b132e","95e212a09cd39440"],"x":120,"y":1095.75,"w":1386,"h":350.5},{"id":"1e2c15f3663b1ddf","type":"group","z":"c4b44f0eb78bc401","name":"test four - statemachine fails with normal exit","style":{"label":true},"nodes":["14b5e2359330d122","84349711621b08b0","1728ae931f30d5f5","d160ea17dd78978c","92637e18abd99338","570597bf2bf59936","9f5a6a1945981be0","f395f550175a280b"],"x":120,"y":1500.25,"w":1331,"h":350.5},{"id":"478d0fb57ab7d26d","type":"group","z":"c4b44f0eb78bc401","name":"test five - statemachine fails with normal exit, one-for-one strategy","style":{"label":true},"nodes":["0b25fc06966958fd","3e782403e4a4fe50","47e1ec98f2567c9b","5ccb66cdda997756","fcd545792fb1dbb6","daca7c01dc91e4e7","fc9065798f097ae2","22bfc5f4e5b9bdc4"],"x":120,"y":1944.25,"w":1331,"h":350.5},{"id":"1861361a9b4d5f62","type":"group","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["e22cb2d8aec50247","25d71387cf585773","568af3c792b45e1c"],"x":640,"y":693,"w":332,"h":299.5},{"id":"66704de95c639175","type":"group","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["49e5fefe075897e0","fe2ca5841d3358d5","8fe56bff6d1168df"],"x":613,"y":350.25,"w":332,"h":282.5},{"id":"ab9e3c02f592be5f","type":"group","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["5c3243ee3bfaaaad","8478146988a90e12","3c709ae77828708a"],"x":589.5,"y":1121.75,"w":412,"h":298.5},{"id":"1728ae931f30d5f5","type":"group","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["bc0212efedef16b2","4e1f4a4569ce4d4b","936910fd837b5872"],"x":547,"y":1526.25,"w":412,"h":298.5},{"id":"47e1ec98f2567c9b","type":"group","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["b2c917d9ee5e37f3","816b5bbd671aef30","57f85cfe0d93761f"],"x":547,"y":1970.25,"w":412,"h":298.5},{"id":"76eed69af6441b74","type":"junction","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","x":519,"y":591.75,"wires":[["fe2ca5841d3358d5","8fe56bff6d1168df"]]},{"id":"57691c2b624686d6","type":"junction","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","x":566,"y":951.5,"wires":[["25d71387cf585773","568af3c792b45e1c"]]},{"id":"c3f4e859ea635735","type":"junction","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","x":495.5,"y":1379.25,"wires":[["8478146988a90e12","3c709ae77828708a"]]},{"id":"14b5e2359330d122","type":"junction","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","x":473,"y":1783.75,"wires":[["4e1f4a4569ce4d4b","936910fd837b5872"]]},{"id":"9f5a6a1945981be0","type":"junction","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","x":280.57141971588135,"y":1791.3235076665878,"wires":[["570597bf2bf59936"]]},{"id":"0b25fc06966958fd","type":"junction","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","x":473,"y":2227.75,"wires":[["816b5bbd671aef30","57f85cfe0d93761f"]]},{"id":"fc9065798f097ae2","type":"junction","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","x":280.57141971588135,"y":2235.323507666588,"wires":[["daca7c01dc91e4e7"]]},{"id":"d67a25d2557a1e2e","type":"junction","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","x":321.57141971588135,"y":1380.3235076665878,"wires":[["138da3cc8b3a5ef2","c3f4e859ea635735"]]},{"id":"49e5fefe075897e0","type":"erlsupervisor","z":"c4b44f0eb78bc401","g":"66704de95c639175","name":"supervisor - one for one","scope":["fe2ca5841d3358d5","8fe56bff6d1168df"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"3","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":755,"y":391.25,"wires":[[]]},{"id":"fe2ca5841d3358d5","type":"function","z":"c4b44f0eb78bc401","g":"66704de95c639175","name":"divide by zero exception","func":" 1 / 0\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":752,"y":591.75,"wires":[["eb32759f57580b45"]]},{"id":"8fe56bff6d1168df","type":"erlstatemachine","z":"c4b44f0eb78bc401","g":"66704de95c639175","name":"","scope":["9403ad72c9007c0a"],"emit_on_state_change":false,"x":779,"y":488,"wires":[["40364d3053b8a4e0"]]},{"id":"9403ad72c9007c0a","type":"erlmodule","z":"c4b44f0eb78bc401","name":"","module_name":"statemachine_and_supervisor","code":"-module(statemachine_and_supervisor).\n\n-behaviour(gen_statem).\n\n-export([\n start/0,\n init/1,\n callback_mode/0,\n handle_event/4,\n code_change/4,\n terminate/3,\n stop/0\n]).\n\ncallback_mode() -> handle_event_function.\n\n%% API. This example uses a registered name name()\n%% and does not link to the caller.\nstart() ->\n gen_statem:start({local, ?MODULE}, ?MODULE, [], []).\n\ninit([]) ->\n State = disconnected,\n Data = 0,\n {ok, State, Data}.\n\n%% Mandatory callback functions\nstop() ->\n gen_statem:stop(?MODULE).\nterminate(_Reason, _State, _Data) ->\n void.\ncode_change(_Vsn, State, Data, _Extra) ->\n {ok,State,Data}.\n\n%%\n%% handler function for state transistions\n%%\n\n%%\n%% Do not much. Increment counter and return the value on each call.\n%%\nhandle_event(\n {call, From},\n {<<\"donothing\">>, <<\"donothing\">>},\n disconnected,\n Data\n) ->\n {keep_state, \n Data+1, \n [{reply, \n From, \n list_to_binary(io_lib:format(\"count ~p\", [Data+1]))\n }\n ]}.\n\n","x":182,"y":128,"wires":[]},{"id":"20e72ff5bec936c8","type":"inject","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":223,"y":589,"wires":[["76eed69af6441b74"]]},{"id":"c2fe41f90a2e86c9","type":"erlmodule","z":"c4b44f0eb78bc401","name":"","module_name":"statemachine_and_supervisor_exit_failure","code":"-module(statemachine_and_supervisor_exit_failure).\n\n-behaviour(gen_statem).\n\n-export([\n start/0,\n init/1,\n callback_mode/0,\n handle_event/4,\n code_change/4,\n terminate/3,\n stop/0\n]).\n\ncallback_mode() -> handle_event_function.\n\n%% API. This example uses a registered name name()\n%% and does not link to the caller.\nstart() ->\n gen_statem:start({local, ?MODULE}, ?MODULE, [], []).\n\ninit([]) ->\n State = disconnected,\n Data = 0,\n {ok, State, Data}.\n\n%% Mandatory callback functions\nstop() ->\n gen_statem:stop(?MODULE).\nterminate(_Reason, _State, _Data) ->\n void.\ncode_change(_Vsn, State, Data, _Extra) ->\n {ok,State,Data}.\n\n%%\n%% handler function for state transistions\n%%\n\n%%\n%% Do not much.\n%%\nhandle_event(\n {call, From},\n {<<\"donothing\">>, <<\"donothing\">>},\n disconnected,\n Data\n) ->\n case Data of \n 3 -> \n exit(self(), failure);\n _ ->\n ignore\n end,\n {keep_state, \n Data+1, \n [{reply, \n From, \n list_to_binary(io_lib:format(\"count ~p\", [Data+1]))\n }\n ]}.\n ","x":223,"y":194,"wires":[]},{"id":"40364d3053b8a4e0","type":"ut-assert-values","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","ignore_failure_if_succeed":true,"rules":[{"p":"payload","pt":"msg","t":"eql","to":"count 5","tot":"str"}],"x":1090,"y":487.5,"wires":[[]]},{"id":"bc4da59c2e1cb9bc","type":"inject","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":223,"y":547.3333333333334,"wires":[["76eed69af6441b74"]]},{"id":"5d5ed051fcaa2ecb","type":"inject","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":223,"y":505.6666666666667,"wires":[["76eed69af6441b74"]]},{"id":"5dd1a7202841bf5d","type":"inject","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":223,"y":464,"wires":[["76eed69af6441b74"]]},{"id":"eb32759f57580b45","type":"ut-assert-failure","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","x":1077,"y":591.75,"wires":[]},{"id":"25b62620c84cb22a","type":"inject","z":"c4b44f0eb78bc401","g":"08b624e4776271aa","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":220,"y":423,"wires":[["76eed69af6441b74"]]},{"id":"e22cb2d8aec50247","type":"erlsupervisor","z":"c4b44f0eb78bc401","g":"1861361a9b4d5f62","name":"supervisor - one for all","scope":["25d71387cf585773","568af3c792b45e1c"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"3","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":803,"y":734,"wires":[[]]},{"id":"25d71387cf585773","type":"function","z":"c4b44f0eb78bc401","g":"1861361a9b4d5f62","name":"exit self failure","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":769,"y":951.5,"wires":[["e86c227ffa1a83c1"]]},{"id":"568af3c792b45e1c","type":"erlstatemachine","z":"c4b44f0eb78bc401","g":"1861361a9b4d5f62","name":"","scope":["9403ad72c9007c0a"],"emit_on_state_change":false,"x":806,"y":847.75,"wires":[["d70e1e108112879f"]]},{"id":"10fc93b29d5a1f22","type":"inject","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":221,"y":949.75,"wires":[["5c1cf21f1fb90b33"]]},{"id":"d70e1e108112879f","type":"ut-assert-values","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","ignore_failure_if_succeed":false,"rules":[{"p":"payload","pt":"msg","t":"eql","to":"count 1","tot":"str"}],"x":1137,"y":847.25,"wires":[[]]},{"id":"11eb87972a6a8401","type":"inject","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":221,"y":908.0833333333334,"wires":[["5c1cf21f1fb90b33"]]},{"id":"00ceb0e4c309bcc0","type":"inject","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":221,"y":866.4166666666667,"wires":[["5c1cf21f1fb90b33"]]},{"id":"bf5bf62875acb4d1","type":"inject","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":221,"y":824.75,"wires":[["5c1cf21f1fb90b33"]]},{"id":"e86c227ffa1a83c1","type":"ut-assert-failure","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","x":1124,"y":951.5,"wires":[]},{"id":"dc5aaefd109f64b8","type":"inject","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":218,"y":783.75,"wires":[["5c1cf21f1fb90b33"]]},{"id":"5c1cf21f1fb90b33","type":"delay","z":"c4b44f0eb78bc401","g":"3e66f8d35dcccd45","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"0.5","randomLast":"3","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":439,"y":783,"wires":[["57691c2b624686d6"]]},{"id":"5c3243ee3bfaaaad","type":"erlsupervisor","z":"c4b44f0eb78bc401","g":"ab9e3c02f592be5f","name":"supervisor - one for all","scope":["8478146988a90e12","3c709ae77828708a"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"3","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":746.5,"y":1162.75,"wires":[[]]},{"id":"8478146988a90e12","type":"function","z":"c4b44f0eb78bc401","g":"ab9e3c02f592be5f","name":"pass through the message","func":"Msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":738.5,"y":1379.25,"wires":[[]]},{"id":"3c709ae77828708a","type":"erlstatemachine","z":"c4b44f0eb78bc401","g":"ab9e3c02f592be5f","name":"","scope":["c2fe41f90a2e86c9"],"emit_on_state_change":false,"x":795.5,"y":1275.5,"wires":[["9cbbda083db5e174","95e212a09cd39440"]]},{"id":"84349711621b08b0","type":"inject","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":226,"y":1569,"wires":[["570597bf2bf59936"]]},{"id":"bc0212efedef16b2","type":"erlsupervisor","z":"c4b44f0eb78bc401","g":"1728ae931f30d5f5","name":"supervisor - one for all","scope":["4e1f4a4569ce4d4b","936910fd837b5872"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"10","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":724,"y":1567.25,"wires":[[]]},{"id":"4e1f4a4569ce4d4b","type":"function","z":"c4b44f0eb78bc401","g":"1728ae931f30d5f5","name":"pass through the message","func":"Msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":716,"y":1783.75,"wires":[[]]},{"id":"936910fd837b5872","type":"erlstatemachine","z":"c4b44f0eb78bc401","g":"1728ae931f30d5f5","name":"","scope":["e7586b6a24f55cb0"],"emit_on_state_change":false,"x":753,"y":1680,"wires":[["d160ea17dd78978c","f395f550175a280b"]]},{"id":"e7586b6a24f55cb0","type":"erlmodule","z":"c4b44f0eb78bc401","name":"","module_name":"statemachine_and_supervisor_exit_normal","code":"-module(statemachine_and_supervisor_exit_normal).\n\n-behaviour(gen_statem).\n\n-export([\n start/0,\n init/1,\n callback_mode/0,\n handle_event/4,\n code_change/4,\n terminate/3,\n stop/0\n]).\n\ncallback_mode() -> handle_event_function.\n\n%% API. This example uses a registered name name()\n%% and does not link to the caller.\nstart() ->\n gen_statem:start({local, ?MODULE}, ?MODULE, [], []).\n\ninit([]) ->\n State = disconnected,\n Data = 0,\n {ok, State, Data}.\n\n%% Mandatory callback functions\nstop() ->\n gen_statem:stop(?MODULE).\nterminate(_Reason, _State, _Data) ->\n void.\ncode_change(_Vsn, State, Data, _Extra) ->\n {ok,State,Data}.\n\n%%\n%% handler function for state transistions\n%%\n\n%%\n%% Do not much.\n%%\nhandle_event(\n {call, From},\n {<<\"donothing\">>, <<\"donothing\">>},\n disconnected,\n Data\n) ->\n case Data of \n 3 -> \n exit(self(), normal);\n _ ->\n ignore\n end,\n {keep_state, \n Data+1, \n [{reply, \n From, \n list_to_binary(io_lib:format(\"count ~p\", [Data+1]))\n }\n ]}.\n ","x":222,"y":252,"wires":[]},{"id":"d160ea17dd78978c","type":"switch","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","name":"filter all generated values","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"count 1","vt":"str"},{"t":"eq","v":"count 2","vt":"str"},{"t":"eq","v":"count 3","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":1133,"y":1594,"wires":[[],[],[],["92637e18abd99338"]]},{"id":"92637e18abd99338","type":"ut-assert-failure","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","name":"","x":1355,"y":1613.5,"wires":[]},{"id":"570597bf2bf59936","type":"delay","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":278,"y":1658,"wires":[["14b5e2359330d122","9f5a6a1945981be0"]]},{"id":"f395f550175a280b","type":"ut-assert-success","z":"c4b44f0eb78bc401","g":"1e2c15f3663b1ddf","name":"","count":"33","x":1298,"y":1679.5,"wires":[]},{"id":"3e782403e4a4fe50","type":"inject","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":226,"y":2013,"wires":[["daca7c01dc91e4e7"]]},{"id":"b2c917d9ee5e37f3","type":"erlsupervisor","z":"c4b44f0eb78bc401","g":"47e1ec98f2567c9b","name":"supervisor - one for one","scope":["816b5bbd671aef30","57f85cfe0d93761f"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"10","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":734,"y":2011.25,"wires":[[]]},{"id":"816b5bbd671aef30","type":"function","z":"c4b44f0eb78bc401","g":"47e1ec98f2567c9b","name":"pass through the message","func":"Msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":716,"y":2227.75,"wires":[[]]},{"id":"57f85cfe0d93761f","type":"erlstatemachine","z":"c4b44f0eb78bc401","g":"47e1ec98f2567c9b","name":"","scope":["e7586b6a24f55cb0"],"emit_on_state_change":false,"x":753,"y":2124,"wires":[["5ccb66cdda997756","22bfc5f4e5b9bdc4"]]},{"id":"5ccb66cdda997756","type":"switch","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","name":"filter all generated values","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"count 1","vt":"str"},{"t":"eq","v":"count 2","vt":"str"},{"t":"eq","v":"count 3","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":1133,"y":2038,"wires":[[],[],[],["fcd545792fb1dbb6"]]},{"id":"fcd545792fb1dbb6","type":"ut-assert-failure","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","name":"","x":1355,"y":2057.5,"wires":[]},{"id":"daca7c01dc91e4e7","type":"delay","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":278,"y":2102,"wires":[["0b25fc06966958fd","fc9065798f097ae2"]]},{"id":"22bfc5f4e5b9bdc4","type":"ut-assert-success","z":"c4b44f0eb78bc401","g":"478d0fb57ab7d26d","name":"","count":"33","x":1298,"y":2123.5,"wires":[]},{"id":"a7096bb288094a00","type":"inject","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","name":"","props":[{"p":"payload"},{"p":"action","v":"donothing","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"donothing","payloadType":"str","x":226,"y":1173,"wires":[["138da3cc8b3a5ef2"]]},{"id":"138da3cc8b3a5ef2","type":"delay","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":319,"y":1247,"wires":[["d67a25d2557a1e2e"]]},{"id":"9cbbda083db5e174","type":"switch","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","name":"filter all generated values","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"count 1","vt":"str"},{"t":"eq","v":"count 2","vt":"str"},{"t":"eq","v":"count 3","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":1188,"y":1179,"wires":[[],[],[],["e722e21ca68b132e"]]},{"id":"e722e21ca68b132e","type":"ut-assert-failure","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","name":"","x":1410,"y":1198.5,"wires":[]},{"id":"95e212a09cd39440","type":"ut-assert-success","z":"c4b44f0eb78bc401","g":"d2676ea9167d324a","name":"","count":"12","x":1251,"y":1275.5,"wires":[]}]
@@ -0,0 +1 @@
1
+ [{"id":"dd3a287f4b66745a","type":"tab","label":"[statemachine] exception if no action to perform","disabled":false,"info":"## Statemachines need actions\n\nIt is an error if a message is sent to an statemachine and no action is defined.\n\nThe statemachine node raises an exception that can be captured or is sent to the debug panel if not captured.","env":[{"name":"ERED_TIMEOUT","type":"num","value":"4"},{"name":"ERED_ONLY","type":"bool","value":"true"}]},{"id":"219c4860668ffeb6","type":"group","z":"dd3a287f4b66745a","name":"no action and no payload","style":{"label":true},"nodes":["ff00e922e9c9859f","7fe03593dc9b5036","6fc1ce91f7c49594","9cac9a2975f9b8ac"],"x":218,"y":405,"w":1146,"h":161},{"id":"4f6089aa3d5f7229","type":"group","z":"dd3a287f4b66745a","name":"no action but payload","style":{"label":true},"nodes":["cdb9ecf983a7b981","6549d77fda872346","0a354df5f0421672","c450e90d1a582c51"],"x":218,"y":616,"w":1158,"h":161},{"id":"ae18f60d92cbeab2","type":"group","z":"dd3a287f4b66745a","name":"no action and no payload","style":{"label":true},"nodes":["fc49f96f7443c0f7","1a0642cf66c03f8b","b6ad34c8434e67a5","39534782b5a0ab5f","036fe945e28fa95f","1db584e1c66a874a"],"x":218,"y":811,"w":1071,"h":167},{"id":"20bff1405f3419d3","type":"group","z":"dd3a287f4b66745a","name":"no action but payload","style":{"label":true},"nodes":["c3f6efe5c2c48cc8","a41f398cd9535ad6","a2887f9cf9f46bc7","c4d12f45eee64463","63d8c6199839dccf","8b46dc9459b596c7"],"x":218,"y":1017,"w":1019,"h":172},{"id":"44281387f23671f5","type":"erlmodule","z":"dd3a287f4b66745a","name":"","module_name":"statemachine_message_no_action","code":"-module(statemachine_message_no_action).\n\n-behaviour(gen_statem).\n\n-export([\n start/0,\n init/1,\n callback_mode/0,\n handle_event/4,\n code_change/4,\n terminate/3,\n stop/0\n]).\n\ncallback_mode() -> handle_event_function.\n\n%% API. This example uses a registered name name()\n%% and does not link to the caller.\nstart() ->\n gen_statem:start({local, ?MODULE}, ?MODULE, [], []).\n\ninit([]) ->\n State = disconnected,\n Data = 0,\n {ok, State, Data}.\n\n%% Mandatory callback functions\nstop() ->\n gen_statem:stop(?MODULE).\nterminate(_Reason, _State, _Data) ->\n void.\ncode_change(_Vsn, State, Data, _Extra) ->\n {ok,State,Data}.\n\n%%\n%% handler function for state transistions\n%%\n\n%%\n%% Do not much. Increment counter and return the value on each call.\n%%\nhandle_event(\n {call, From},\n {<<\"donothing\">>, <<\"donothing\">>},\n disconnected,\n Data\n) ->\n {keep_state, \n Data+1, \n [{reply, \n From, \n list_to_binary(io_lib:format(\"count ~p\", [Data+1]))\n }\n ]}.\n\n","x":392,"y":233,"wires":[]},{"id":"ff00e922e9c9859f","type":"erlstatemachine","z":"dd3a287f4b66745a","g":"219c4860668ffeb6","name":"","scope":["44281387f23671f5"],"emit_on_state_change":false,"x":720,"y":446,"wires":[[]]},{"id":"7fe03593dc9b5036","type":"inject","z":"dd3a287f4b66745a","g":"219c4860668ffeb6","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":314,"y":525,"wires":[["ff00e922e9c9859f"]]},{"id":"6fc1ce91f7c49594","type":"ut-assert-debug","z":"dd3a287f4b66745a","g":"219c4860668ffeb6","name":"","scope":["ff00e922e9c9859f"],"nodeid":"ff00e922e9c9859f","msgtype":"error","inverse":false,"x":851,"y":525,"wires":[["9cac9a2975f9b8ac"]]},{"id":"cdb9ecf983a7b981","type":"erlstatemachine","z":"dd3a287f4b66745a","g":"4f6089aa3d5f7229","name":"","scope":["44281387f23671f5"],"emit_on_state_change":false,"x":710,"y":657,"wires":[[]]},{"id":"6549d77fda872346","type":"inject","z":"dd3a287f4b66745a","g":"4f6089aa3d5f7229","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"fubar","payloadType":"str","x":314,"y":736,"wires":[["cdb9ecf983a7b981"]]},{"id":"0a354df5f0421672","type":"ut-assert-debug","z":"dd3a287f4b66745a","g":"4f6089aa3d5f7229","name":"","scope":["cdb9ecf983a7b981"],"nodeid":"cdb9ecf983a7b981","msgtype":"error","inverse":false,"x":841,"y":736,"wires":[["c450e90d1a582c51"]]},{"id":"39534782b5a0ab5f","type":"catch","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","scope":["fc49f96f7443c0f7"],"uncaught":false,"x":901,"y":852,"wires":[["036fe945e28fa95f"]]},{"id":"fc49f96f7443c0f7","type":"erlstatemachine","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","scope":["44281387f23671f5"],"emit_on_state_change":false,"x":678,"y":852,"wires":[[]]},{"id":"1a0642cf66c03f8b","type":"inject","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":314,"y":937,"wires":[["fc49f96f7443c0f7"]]},{"id":"b6ad34c8434e67a5","type":"ut-assert-debug","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","scope":["fc49f96f7443c0f7"],"nodeid":"fc49f96f7443c0f7","msgtype":"error","inverse":true,"x":789,"y":937,"wires":[["1db584e1c66a874a"]]},{"id":"c3f6efe5c2c48cc8","type":"erlstatemachine","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","scope":["44281387f23671f5"],"emit_on_state_change":false,"x":668,"y":1058,"wires":[[]]},{"id":"a41f398cd9535ad6","type":"inject","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"fubar","payloadType":"str","x":314,"y":1148,"wires":[["c3f6efe5c2c48cc8"]]},{"id":"a2887f9cf9f46bc7","type":"ut-assert-debug","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","scope":["c3f6efe5c2c48cc8"],"nodeid":"c3f6efe5c2c48cc8","msgtype":"error","inverse":true,"x":779,"y":1148,"wires":[["8b46dc9459b596c7"]]},{"id":"c4d12f45eee64463","type":"catch","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","scope":["c3f6efe5c2c48cc8"],"uncaught":false,"x":896,"y":1058,"wires":[["63d8c6199839dccf"]]},{"id":"63d8c6199839dccf","type":"ut-assert-success","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","count":1,"x":1121,"y":1058,"wires":[]},{"id":"036fe945e28fa95f","type":"ut-assert-success","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","count":1,"x":1173,"y":852,"wires":[]},{"id":"1db584e1c66a874a","type":"ut-assert-failure","z":"dd3a287f4b66745a","g":"ae18f60d92cbeab2","name":"","x":1173,"y":937,"wires":[]},{"id":"8b46dc9459b596c7","type":"ut-assert-failure","z":"dd3a287f4b66745a","g":"20bff1405f3419d3","name":"","x":1121,"y":1148,"wires":[]},{"id":"c450e90d1a582c51","type":"ut-assert-values","z":"dd3a287f4b66745a","g":"4f6089aa3d5f7229","name":"","ignore_failure_if_succeed":false,"rules":[{"t":"eql","p":"data.id","pt":"msg","to":"cdb9ecf983a7b981","tot":"str"},{"t":"eql","p":"data.type","pt":"msg","to":"erlstatemachine","tot":"str"},{"t":"eql","p":"data['level']","pt":"msg","to":"20","tot":"num"},{"t":"eql","p":"data.format","pt":"msg","to":"error","tot":"str"},{"t":"eql","p":"data.msg.error_msg","pt":"msg","to":"no action to perform","tot":"str"}],"x":1270,"y":736,"wires":[[]]},{"id":"9cac9a2975f9b8ac","type":"ut-assert-values","z":"dd3a287f4b66745a","g":"219c4860668ffeb6","name":"","ignore_failure_if_succeed":false,"rules":[{"t":"eql","p":"data.id","pt":"msg","to":"ff00e922e9c9859f","tot":"str"},{"t":"eql","p":"data.type","pt":"msg","to":"erlstatemachine","tot":"str"},{"t":"eql","p":"data['level']","pt":"msg","to":"20","tot":"num"},{"t":"eql","p":"data.format","pt":"msg","to":"error","tot":"str"},{"t":"eql","p":"data.msg.error_msg","pt":"msg","to":"no action to perform","tot":"str"}],"x":1258,"y":525,"wires":[[]]}]
@@ -0,0 +1 @@
1
+ [{"id":"a916165378c446e3","type":"tab","label":"[status] basic working version","disabled":false,"info":"Status node listens to other nodes for their status updates. It then posts these status updates as its messages","env":[{"name":"ERED_PENDING","value":"false","type":"bool"},{"name":"ERED_TIMEOUT","value":"6","type":"num"}]},{"id":"116137642eb0cbe7","type":"debug","z":"a916165378c446e3","name":"debug 395","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"status.text","targetType":"msg","statusVal":"payload","statusType":"msg","x":727,"y":316,"wires":[]},{"id":"34cbd3682d560baf","type":"status","z":"a916165378c446e3","name":"","scope":["116137642eb0cbe7"],"x":239,"y":705.1071634292603,"wires":[["a1142417496ed5ef","0532caa79b85ad02"]]},{"id":"d4a3eab1fe256e75","type":"inject","z":"a916165378c446e3","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"e","payloadType":"str","x":307,"y":489,"wires":[["aa935988bc52cb94"]]},{"id":"aa935988bc52cb94","type":"delay","z":"a916165378c446e3","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":524,"y":489,"wires":[["116137642eb0cbe7"]]},{"id":"f85c03456c8d0d25","type":"inject","z":"a916165378c446e3","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"b","payloadType":"str","x":215,"y":407.5,"wires":[["792349f35f115592"]]},{"id":"792349f35f115592","type":"delay","z":"a916165378c446e3","name":"","pauseType":"delay","timeout":"750","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":414,"y":407.5,"wires":[["116137642eb0cbe7"]]},{"id":"a1142417496ed5ef","type":"join","z":"a916165378c446e3","name":"","mode":"custom","build":"array","property":"status.text","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":505,"y":772.5,"wires":[["8e7239952bc1b21c"]]},{"id":"0532caa79b85ad02","type":"ut-assert-success","z":"a916165378c446e3","name":"","count":"3","x":747.9999923706055,"y":705.1071634292603,"wires":[]},{"id":"249a4c9fa0ef8ded","type":"inject","z":"a916165378c446e3","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"b","payloadType":"str","x":299,"y":316,"wires":[["116137642eb0cbe7"]]},{"id":"8e7239952bc1b21c","type":"ut-assert-values","z":"a916165378c446e3","name":"","ignore_failure_if_succeed":false,"rules":[{"t":"eql","p":"data.text","pt":"msg","to":"[\"b\", \"e\", \"b\"]","tot":"jsonata"}],"x":744,"y":854.5,"wires":[[]]}]
@@ -0,0 +1 @@
1
+ [{"id":"a1b70e98f22a1eb0","type":"tab","label":"[status] only one message per status value","disabled":false,"info":"Statue node generates a message but only if the status differs from the previous status value.\n\nAlso status also has an endless loop problem when second degree nodes also generate a status.\n\nStatus nodes ignore direct connections but not indirect connections.\n\n**Problem**\n\nCurrently the status message does not generate just one message for duplication, it generates a message always.","env":[{"name":"ERED_PENDING","value":"true","type":"bool"},{"name":"NRED_PENDING","value":"true","type":"bool"}]},{"id":"2a4c7e6d90019e1a","type":"ut-assert-failure","z":"a1b70e98f22a1eb0","name":"","x":451,"y":521.5,"wires":[]},{"id":"691b9439e4e15f14","type":"inject","z":"a1b70e98f22a1eb0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":202,"y":459,"wires":[["2a4c7e6d90019e1a"]]}]
@@ -0,0 +1 @@
1
+ [{"id":"0697e9392947472e","type":"tab","label":"[status] source map inside the status map","disabled":false,"info":"## Structure of the status attribute\n\nThe status attribute set on the msg object has the following Structure:\n\n```\n status: {\n fill: \"grey\"\n shape: \"dot\"\n text: \"e\"\n source: {\n id: \"97abdd5fa249b712\"\n type: \"debug\"\n name: \"debug 395\"\n },\n },\n```\n\nthat is the source is encapsulated inside the status map.","env":[{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"c6acfc7fedcfd0c3","type":"status","z":"0697e9392947472e","name":"","scope":["5909c551445da5ee"],"x":409,"y":591,"wires":[["4b084bd0670af8a4"]]},{"id":"5909c551445da5ee","type":"function","z":"0697e9392947472e","name":"function 2","func":"node_helpers:status(Msg,NodeDef,<<\"hello\">>,green,dot),\nMsg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":388,"y":482,"wires":[[]]},{"id":"990b30835b3279c1","type":"erlmodule","z":"0697e9392947472e","name":"","module_name":"node_helpers","code":"-module(node_helpers).\n\n-import(ered_nodered_comm, [\n send_out_debug_msg/4,\n node_status/5,\n node_status_clear/2,\n post_exception_or_debug/3\n]).\n\n-import(ered_messages, [\n set_prop_value/3\n]).\n\n-import(ered_nodes, [\n send_msg_to_connected_nodes/2,\n send_msg_on/2\n]).\n\n%%\n%% Node helpers, things that affect what the state of the node \n-export([\n status/5,\n status_with_clear/6,\n exception/3,\n debug/4,\n unsupported/3\n]).\n\n%%\n%% Message helpers to help updating content on the message map\n-export([\n msg_update/3,\n msg_send/2,\n msg_send_on_port/3\n]).\n\n%%\n%% Sends the message out on a specific port.\n%% If a function happens to have multiple ports, then\n%% use this to send a message out on exactly one of those\n%% ports. \n%% Ports are 1-based, i.e. they start at 1 and increase by\n%% one.\n-spec msg_send_on_port(\n Port :: 0..65322,\n Msg:: map(),\n NodeDef :: map()\n) -> any() | none().\nmsg_send_on_port(_, _, #{ <<\"wires\">> := [] } ) ->\n ignore;\nmsg_send_on_port(1, Msg, #{ <<\"wires\">> := [SetOfWires | _RestWires] }) ->\n send_msg_on(SetOfWires, Msg);\nmsg_send_on_port(Port, Msg, #{ <<\"wires\">> := [_SetOfWires | RestWires] }) when Port > 1 ->\n msg_send_on_wires(Msg, RestWires, Port - 1);\nmsg_send_on_port(_, _, _) ->\n ignore.\n\nmsg_send_on_wires(_, [], _) ->\n ignore;\nmsg_send_on_wires(Msg, [SetOfWires | _RestWires], 1) ->\n send_msg_on(SetOfWires, Msg);\nmsg_send_on_wires(Msg, [_SetOfWires | RestWires], Port) ->\n msg_send_on_wires(Msg, RestWires, Port - 1).\n\n%%\n%% Send out a message to all nodes connected this this node.\n%% A function node can then either return the message and the \n%% message will be sent again or it returns the atom `undefined` and\n%% nothing happens. Because it has already sent the messages.\n-spec msg_send(\n Msg :: map(),\n NodeDef :: map()\n) -> any() | none().\nmsg_send(Msg, NodeDef) ->\n send_msg_to_connected_nodes(NodeDef, Msg).\n \n%%\n%% Update a value in the msg, creating nested maps and lists as needed.\n%% Property is defined in `key.dot.sq[number]` form, i.e., whatever Node-RED\n%% supports, this can too.\n-spec msg_update(\n Msg :: map(),\n PropName :: string(),\n Value :: any() \n) -> map().\nmsg_update( Msg, PropName, Value ) ->\n set_prop_value(PropName, Value, Msg).\n\n%%\n%% Add a node status: \n-spec status( \n Msg :: map(),\n NodeDef :: map(),\n Txt :: binary(),\n Clr :: 'grey' | 'yellow' | 'blue' | 'red' | 'green',\n Shp :: 'ring' | 'dot' \n) -> Msg :: map().\nstatus(#{'_ws' := WsName} = Msg, NodeDef, Txt, Clr, Shp) ->\n node_status(WsName, NodeDef, Txt, atom_to_binary(Clr), atom_to_binary(Shp)),\n Msg.\n\n%%\n%% show status and then clear it again after Timeout seconds\n-spec status_with_clear( \n Msg :: map(),\n NodeDef :: map(),\n Txt :: binary(),\n Clr :: 'grey' | 'yellow' | 'blue' | 'red' | 'green',\n Shp :: 'ring' | 'dot',\n Timeout :: integer()\n) -> Msg :: map().\nstatus_with_clear(#{'_ws' := WsName} = Msg, NodeDef, Txt, Clr, Shp, Timeout) ->\n node_status(WsName, NodeDef, Txt, atom_to_binary(Clr), atom_to_binary(Shp)),\n timer:apply_after(Timeout * 1000, fun() -> node_status_clear(WsName, NodeDef) end),\n Msg.\n\n%%\n%% Raise an exception that can be caught by a \n%% catch node.\n-spec exception(\n Msg :: map(),\n NodeDef :: map(),\n ErrorMsg :: binary()\n) -> Msg :: map().\nexception(Msg, NodeDef, ErrorMsg) ->\n post_exception_or_debug(NodeDef, Msg, ErrorMsg),\n Msg.\n\n%%\n%% Post a debug message to the debug panel\n-spec debug(\n Msg :: map(),\n NodeDef :: map(),\n ErrorMsg :: binary(),\n ErrorType :: 'error' | 'warning' | 'notice' | 'normal'\n) -> Msg :: map().\ndebug(Msg, NodeDef, ErrorMsg, ErrorType) ->\n send_out_debug_msg(NodeDef, Msg, ErrorMsg, ErrorType),\n Msg.\n\n%%\n%% Unsupported message, advices the user that something is not\n%% supported by the implementation. This will generate a mesage\n%% in the debug panel to raise the issue with the user.\n-spec unsupported(\n Msg :: map(),\n NodeDef :: map(),\n ErrorMsg :: binary()\n) -> Msg :: map().\nunsupported(Msg, NodeDef, ErrorMsg) ->\n ered_nodered_comm:unsupported(NodeDef, Msg, ErrorMsg),\n Msg.","x":397,"y":150,"wires":[]},{"id":"aea86e221c17b9fa","type":"inject","z":"0697e9392947472e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":155,"y":332,"wires":[["5909c551445da5ee"]]},{"id":"4b084bd0670af8a4","type":"ut-assert-values","z":"0697e9392947472e","name":"","ignore_failure_if_succeed":false,"rules":[{"t":"eql","p":"status.source.id","pt":"msg","to":"5909c551445da5ee","tot":"str"}],"x":733,"y":339.5,"wires":[[]]}]
@@ -0,0 +1 @@
1
+ [{"id":"f47f7da6ad1183ed","type":"tab","label":"[supervisor] inform user if config needs updating","disabled":false,"info":"<small><i>[Share link](https://flows.red-erik.org/f/f47f7da6ad1183ed)</i></small>\n\n## Supervisor confguration error\n\nSometimes the list of nodes that a supervisor is supervising becomes corrupt because nodes disappear.\n\nHere the <a class=\"ahl-node-only\" data-ids=\"31ee488a4d75c258\">supervisor: 4</a> is configured to supervise four nodes but one was removed *without* updating supervisors configuration.\n\nDeploying this flow will cause an error message to be show in the debug panel.\n\n<a class=\"ahl-node-only\" data-ids=\"0fb823250d0b7c2c\">supervisor: 1</a> also errors out because it is configured to supervise <a class=\"ahl-node-only\" data-ids=\"31ee488a4d75c258\">supervisor: 4</a> but that node never comes online. So it is also missing a node to be configured correctly.","env":[{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"31ee488a4d75c258","type":"erlsupervisor","z":"f47f7da6ad1183ed","name":"","scope":["537867aa29a877d0","c60c0fc735c5efda","fa7dc048703a0950","48250f1d8a63086a"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"5","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1413,"y":816,"wires":[[]]},{"id":"537867aa29a877d0","type":"function","z":"f47f7da6ad1183ed","name":"function 1","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n Msg\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1171,"y":900,"wires":[[]]},{"id":"c60c0fc735c5efda","type":"function","z":"f47f7da6ad1183ed","name":"function 2","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n Msg\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1220,"y":958,"wires":[[]]},{"id":"fa7dc048703a0950","type":"function","z":"f47f7da6ad1183ed","name":"function 3","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n Msg\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1282,"y":1009,"wires":[[]]},{"id":"0fb823250d0b7c2c","type":"erlsupervisor","z":"f47f7da6ad1183ed","name":"","scope":["31ee488a4d75c258"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"5","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1232,"y":696,"wires":[[]]}]
@@ -0,0 +1 @@
1
+ [{"id":"3afa3b2ec00a5e3d","type":"tab","label":"[supervisor] multiple individual supervisors","disabled":false,"info":"<small><i>[Share link](https://flows.red-erik.org/f/3afa3b2ec00a5e3d)</i></small>\n\nDemonstrate the various configurations of the supervisor node visually.\n\nFor more details on the configuration of Supervisors, check the [OTP documentation](https://www.erlang.org/doc/apps/stdlib/supervisor.html).\n\n## Setup\n\nFirst comes the source of messages. <a class='ahl-group-only' data-ids='f75f3dfd9421f0f1'>Message generator</a> that generates a continous stream of messages until 20k messages have been generated.\n\nThese messages are feed into nodes that are supervised by a supervisor. A <a class='ahl-node-only' data-ids='ca381bfca1c3a6a8'>link out node</a> and several <a class='ahl-node-only' data-ids='6dffa4232a7ec9a9,7835bb0a66ce9604,07a48d0ae3691dfd,f032986923013ead'>link in nodes</a> do this.\n\nSupervisor <a class='ahl-group-only' data-ids='f819a208c9a9e301'>restart flow</a> takes care of restarting supervisors if they die. This happens when their intensity/period limits are hit. For these tests, that is always 150/30, i.e. 150 failures within a 30 second period causes the supervisor to die and with it, the nodes it was supervising. Supervisor nodes supervising other supervisor nodes is not yet implemented but ErlangRED provides an alternative solution as implemeted here.\n\n\n## TL;DR\n\nThis is an image of a previous iteration of the supervisor node as discussed in the [Erlang forum](https://erlangforums.com/t/erlangred-supervisor-node-any-other-configuration-that-might-be-necessary-for-a-supervisor/4776/2?u=gorenje).\n\n![img](https://cdn.openmindmap.org/content/1748163187042_erlang-red-supervisor2.gif)\n\nWhat is shown is a supervisor that is supervising three function nodes and two debug nodes. The debug nodes are just counting messages as they come in. The bottom and top function nodes just pass through the messages they receive and the middle function node does an `exit(self(), failure)` - its the process/node that is failing.\n\nThe supervisor has an intensity of 500 over 30 seconds. Not shown is a message generator that is an infinite loop that pauses for 5 millisecond between messages. The debug node at the very bottom is counting those messages.\n\nThe order in which the child processes are started is defined in the supervisor node. The order is as shown in the image, from top to bottom: `function 1`, `debug 1`, `exit call`, `function 3` and `debug 6`. This will become important with the rest-for-one restart strategy. \n\nSo what happens? When the first message comes in (all function nodes receive the same messages), the exit call function fails and the supervisor restarts it.\n\nFor one-for-all, all nodes are restarted. The debug nodes have their counts reset to zero and hence they are showing 1. It’s always a new message but they never get beyond one message because the exit-call function keeps being restarted by the supervisor and so are the debug nodes (the green nodes).\n\nThe one-for-one strategy shows the debug nodes hitting a message count of 501 because after 500 messages, the supervisor dies. What is not shown is that the supervisor is automagically restarted after two seconds (shown by the status of the supervisor node). When the supervisor is restarted, the processes that represent the function and debug nodes are restarted and begin receiving message from existing nodes/processes again.\n\nFinally the rest-for-one strategy shows that the top debug continues to receive messages (i.e. isn’t restarted) when the exit function is restarted but the debug 6 counter stays at 1 - because it’s being restarted and only receives one message before being restarted.\n\n## Supervisors\n\nFour supervisors are defined that each supervise two debug nodes and one function node. The function node exits with a call to exit. Each supervisor implements a different restart strategy.\n\n- <a class='ahl-group-only' data-ids='2936cc7950d10f77'>rest-for-one</a> ordering being top to bottom meaning that the <a class='ahl-node-only' data-ids='40091b993841f325'>exit call function node</a>, when restarted, will also cause the nodes below it to be restarted.\n\n- <a class='ahl-group-only' data-ids='859955c795ba6c86'>rest-for-one</a> ordering being bottom to top meaning that the <a class='ahl-node-only' data-ids='0bd18da85d825d6f'>exit call function node</a>, when restarted, will also cause the nodes above it to be restarted.\n\n- <a class='ahl-group-only' data-ids='34c704ff5c1978cf'>one-for-one</a> here when the <a class='ahl-node-only' data-ids='4c545d0296232dbb'>function node</a> is restarted by the <a class='ahl-node-only' data-ids='61de32d2e9fdd19f'>supervisor node</a>, the two <a class='ahl-node-only' data-ids='e51d981260fcda5f,38c20f8cb95a4965'>debug nodes</a> are affected and only stopped once the supervisor dies. Hence both debung nodes hit a count of 150.\n\n- <a class='ahl-group-only' data-ids='fa67af97329dd415'>one-for-all</a> means that all nodes under supervision are restarted if any node fails and is restarted. This means that the <a class='ahl-node-only' data-ids='9d89f7d1f2181a14,8123a9952db0b131'>debug nodes</a> are constantly being restarted by the <a class='ahl-node-only' data-ids='57e6cd2a05214926'>supervisor node</a> since the <a class='ahl-node-only' data-ids='3fe75266b20c7d3f'>function node</a> is constantly dying. The debug nodes show a count of 1 but that is always a new message - this can be experienced by getting the debug nodes to send their messages to the debug panel.\n\n[Next: Single Supervisor with restart flow](https://flows.red-erik.org/f/6b22ce2a482c2d6d).","env":[{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"2936cc7950d10f77","type":"group","z":"3afa3b2ec00a5e3d","name":"rest - for - one - order top to bottom","style":{"label":true},"nodes":["4ae02f63f450c6f9","40091b993841f325","54a9791650cb61b7","23d96d3b8391cef5","d52aac5750f2bb0c","f0ee2b3e4781eb6f","43aa4576cc0449fd","f38f641b0fe0202f","7cdde8314f6355d7","f032986923013ead"],"x":487,"y":856.010320186615,"w":334.92850494384766,"h":780.0610542297363},{"id":"859955c795ba6c86","type":"group","z":"3afa3b2ec00a5e3d","name":"rest - for - one - order bottom to top","style":{"label":true},"nodes":["d429c9c28047ef4c","0bd18da85d825d6f","b50a8242b41ae0c6","92ec6d9f3d879580","ee2f23c2b6fee4f8","2080a6ce08b2c7de","cd3028c339baf502","46f646d7334123c2","74c3ab0399dc06e2","07a48d0ae3691dfd"],"x":882,"y":856.1666030883789,"w":339.92850494384766,"h":779.9047713279724},{"id":"34c704ff5c1978cf","type":"group","z":"3afa3b2ec00a5e3d","name":"one - for - one","style":{"label":true},"nodes":["61de32d2e9fdd19f","4c545d0296232dbb","e51d981260fcda5f","38c20f8cb95a4965","aa1dbbcfff2809b7","55a6ebecbdbb73e7","c255165743dab74e","29471e95423b991b","0d8e15cfb25a1343","7835bb0a66ce9604"],"x":1326,"y":856.1666030883789,"w":335.92850494384766,"h":779.9047713279724},{"id":"fa67af97329dd415","type":"group","z":"3afa3b2ec00a5e3d","name":"one - for - all","style":{"label":true},"nodes":["57e6cd2a05214926","3fe75266b20c7d3f","9d89f7d1f2181a14","8123a9952db0b131","0ab6b6e6cbe62b6a","e73de5dd8451e30b","dcfd4fec22f930eb","3dd04914baf158a5","1e697584bfe7e0b7","6dffa4232a7ec9a9"],"x":1732.4285888671875,"y":857.1666030883789,"w":340.92850494384766,"h":778.9047713279724},{"id":"f75f3dfd9421f0f1","type":"group","z":"3afa3b2ec00a5e3d","name":"Message generator","style":{"label":true},"nodes":["5ee386c316c97c98","d4f0e1e9a072564c","c21afac904cde5e5","6c8fa72eb01d983a","ca381bfca1c3a6a8","397ff5c6eab3be66"],"x":100,"y":64.41222381591797,"w":766.3333740234375,"h":299.08252716064453},{"id":"f819a208c9a9e301","type":"group","z":"3afa3b2ec00a5e3d","name":"supervisor restarter","style":{"label":true},"nodes":["e7ea5b5137caea30","b876a72386d90b15","c9794e21debc9042","1a14a3c9d29e9969","42d44efed110f119"],"x":1329,"y":124.41150665283203,"w":804.833251953125,"h":97},{"id":"43aa4576cc0449fd","type":"junction","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","x":587.2502408027649,"y":1498.25,"wires":[["23d96d3b8391cef5","40091b993841f325","54a9791650cb61b7"]]},{"id":"74c3ab0399dc06e2","type":"junction","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","x":985.9489097595215,"y":1498.625,"wires":[["92ec6d9f3d879580","0bd18da85d825d6f","b50a8242b41ae0c6"]]},{"id":"0d8e15cfb25a1343","type":"junction","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","x":1425.9489097595215,"y":1497.625,"wires":[["38c20f8cb95a4965","4c545d0296232dbb","e51d981260fcda5f"]]},{"id":"1e697584bfe7e0b7","type":"junction","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","x":1837.377498626709,"y":1498.625,"wires":[["8123a9952db0b131","3fe75266b20c7d3f","9d89f7d1f2181a14"]]},{"id":"5ee386c316c97c98","type":"inject","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"Start Button","props":[{"p":"payload"},{"p":"msgcnt","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":274.0000305175781,"y":105.41222381591797,"wires":[["d4f0e1e9a072564c"]]},{"id":"d4f0e1e9a072564c","type":"change","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"},{"p":"msgcnt","pt":"msg","t":"set","to":"$$.msgcnt + 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":524.3333740234375,"y":211.1197509765625,"wires":[["c21afac904cde5e5","6c8fa72eb01d983a","ca381bfca1c3a6a8"]]},{"id":"c21afac904cde5e5","type":"delay","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":770.3333740234375,"y":322.4947509765625,"wires":[["397ff5c6eab3be66"]]},{"id":"6c8fa72eb01d983a","type":"debug","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"debug 2","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":760.3333740234375,"y":105.41222381591797,"wires":[]},{"id":"e7ea5b5137caea30","type":"switch","z":"3afa3b2ec00a5e3d","g":"f819a208c9a9e301","name":"what status?","property":"status","propertyType":"msg","rules":[{"t":"eq","v":"dead","vt":"str"},{"t":"eq","v":"started","vt":"str"},{"t":"eq","v":"restarted","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":1522.166748046875,"y":172.91150665283203,"wires":[["b876a72386d90b15"],[],[]]},{"id":"b876a72386d90b15","type":"delay","z":"3afa3b2ec00a5e3d","g":"f819a208c9a9e301","name":"","pauseType":"random","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"7","randomUnits":"milliseconds","drop":false,"allowrate":false,"outputs":1,"x":1726.0953922271729,"y":172.91150665283203,"wires":[["c9794e21debc9042"]]},{"id":"c9794e21debc9042","type":"change","z":"3afa3b2ec00a5e3d","g":"f819a208c9a9e301","name":"","rules":[{"p":"action","pt":"msg","t":"set","to":"restart","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1917.547607421875,"y":172.91150665283203,"wires":[["42d44efed110f119"]]},{"id":"4ae02f63f450c6f9","type":"erlsupervisor","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"rest for one","scope":["23d96d3b8391cef5","40091b993841f325","54a9791650cb61b7"],"supervisor_type":"static","strategy":"rest_for_one","auto_shutdown":"never","intensity":"150","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"","x":668.0000038146973,"y":1015.5,"wires":[["d52aac5750f2bb0c"]]},{"id":"40091b993841f325","type":"function","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"exit call","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":718.5,"y":1498.25,"wires":[[]]},{"id":"54a9791650cb61b7","type":"debug","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"debug 1","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":713.5000839233398,"y":1595.0713744163513,"wires":[]},{"id":"23d96d3b8391cef5","type":"debug","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"debug 3","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":715.9285049438477,"y":1407.0104055404663,"wires":[]},{"id":"d52aac5750f2bb0c","type":"change","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"","rules":[{"p":"supervisor","pt":"msg","t":"set","to":"one","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":668.0000038146973,"y":1085.343686580658,"wires":[["7cdde8314f6355d7"]]},{"id":"f0ee2b3e4781eb6f","type":"switch","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"","property":"supervisor","propertyType":"msg","rules":[{"t":"eq","v":"one","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":668.0000038146973,"y":955.3436636924744,"wires":[["4ae02f63f450c6f9"]]},{"id":"d429c9c28047ef4c","type":"erlsupervisor","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"rest for one","scope":["b50a8242b41ae0c6","0bd18da85d825d6f","92ec6d9f3d879580"],"supervisor_type":"static","strategy":"rest_for_one","auto_shutdown":"never","intensity":"150","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"","x":1068.0000038146973,"y":1015.5,"wires":[["ee2f23c2b6fee4f8"]]},{"id":"0bd18da85d825d6f","type":"function","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"exit call","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1118.5,"y":1498.625,"wires":[[]]},{"id":"b50a8242b41ae0c6","type":"debug","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"debug 4","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1113.5000839233398,"y":1595.0713744163513,"wires":[]},{"id":"92ec6d9f3d879580","type":"debug","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"debug 5","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1115.9285049438477,"y":1407.0104055404663,"wires":[]},{"id":"ee2f23c2b6fee4f8","type":"change","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"","rules":[{"p":"supervisor","pt":"msg","t":"set","to":"two","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1068.0000038146973,"y":1085.343686580658,"wires":[["46f646d7334123c2"]]},{"id":"2080a6ce08b2c7de","type":"switch","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"","property":"supervisor","propertyType":"msg","rules":[{"t":"eq","v":"two","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1068.0000038146973,"y":955.3436636924744,"wires":[["d429c9c28047ef4c"]]},{"id":"f38f641b0fe0202f","type":"link in","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"sup one","links":["42d44efed110f119"],"x":668.0000038146973,"y":897.010320186615,"wires":[["f0ee2b3e4781eb6f"]]},{"id":"7cdde8314f6355d7","type":"link out","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"link out 1","mode":"link","links":["1a14a3c9d29e9969"],"x":668.0000038146973,"y":1150.3436821301777,"wires":[]},{"id":"cd3028c339baf502","type":"link in","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"sup two","links":["42d44efed110f119"],"x":1068.0000038146973,"y":897.1666030883789,"wires":[["2080a6ce08b2c7de"]]},{"id":"46f646d7334123c2","type":"link out","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"link out 3","mode":"link","links":["1a14a3c9d29e9969"],"x":1068.0000038146973,"y":1148.8333129882812,"wires":[]},{"id":"1a14a3c9d29e9969","type":"link in","z":"3afa3b2ec00a5e3d","g":"f819a208c9a9e301","name":"undertaker","links":["46f646d7334123c2","7cdde8314f6355d7","29471e95423b991b","3dd04914baf158a5"],"x":1370,"y":172.91150665283203,"wires":[["e7ea5b5137caea30"]]},{"id":"61de32d2e9fdd19f","type":"erlsupervisor","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"one for one","scope":["e51d981260fcda5f","4c545d0296232dbb","38c20f8cb95a4965"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"150","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"","x":1508.0000038146973,"y":1015.5,"wires":[["aa1dbbcfff2809b7"]]},{"id":"4c545d0296232dbb","type":"function","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"exit call","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1558.5,"y":1497.625,"wires":[[]]},{"id":"e51d981260fcda5f","type":"debug","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"debug 6","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1553.5000839233398,"y":1595.0713744163513,"wires":[]},{"id":"38c20f8cb95a4965","type":"debug","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"debug 7","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1555.9285049438477,"y":1407.0104055404663,"wires":[]},{"id":"aa1dbbcfff2809b7","type":"change","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"","rules":[{"p":"supervisor","pt":"msg","t":"set","to":"three","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1508.0000038146973,"y":1085.343686580658,"wires":[["29471e95423b991b"]]},{"id":"55a6ebecbdbb73e7","type":"switch","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"","property":"supervisor","propertyType":"msg","rules":[{"t":"eq","v":"three","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1508.0000038146973,"y":955.3436636924744,"wires":[["61de32d2e9fdd19f"]]},{"id":"c255165743dab74e","type":"link in","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"sup three","links":["42d44efed110f119"],"x":1508.0000038146973,"y":897.1666030883789,"wires":[["55a6ebecbdbb73e7"]]},{"id":"29471e95423b991b","type":"link out","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"link out 4","mode":"link","links":["1a14a3c9d29e9969"],"x":1508.0000038146973,"y":1148.8333129882812,"wires":[]},{"id":"57e6cd2a05214926","type":"erlsupervisor","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"one for all","scope":["9d89f7d1f2181a14","3fe75266b20c7d3f","8123a9952db0b131"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"150","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"","x":1911.4285926818848,"y":1016.5,"wires":[["0ab6b6e6cbe62b6a"]]},{"id":"3fe75266b20c7d3f","type":"function","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"exit call","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1969.9285888671875,"y":1498.625,"wires":[[]]},{"id":"9d89f7d1f2181a14","type":"debug","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"debug 8","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1964.9286727905273,"y":1595.0713744163513,"wires":[]},{"id":"8123a9952db0b131","type":"debug","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"debug 9","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1967.3570938110352,"y":1407.0104055404663,"wires":[]},{"id":"0ab6b6e6cbe62b6a","type":"change","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"","rules":[{"p":"supervisor","pt":"msg","t":"set","to":"four","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1911.4285926818848,"y":1086.343686580658,"wires":[["3dd04914baf158a5"]]},{"id":"e73de5dd8451e30b","type":"switch","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"","property":"supervisor","propertyType":"msg","rules":[{"t":"eq","v":"four","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1911.4285926818848,"y":956.3436636924744,"wires":[["57e6cd2a05214926"]]},{"id":"dcfd4fec22f930eb","type":"link in","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"sup four","links":["42d44efed110f119"],"x":1911.4285926818848,"y":898.1666030883789,"wires":[["e73de5dd8451e30b"]]},{"id":"3dd04914baf158a5","type":"link out","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"link out 5","mode":"link","links":["1a14a3c9d29e9969"],"x":1911.4285926818848,"y":1149.8333129882812,"wires":[]},{"id":"ca381bfca1c3a6a8","type":"link out","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"msg generator","mode":"link","links":["f032986923013ead","07a48d0ae3691dfd","7835bb0a66ce9604","6dffa4232a7ec9a9"],"x":715.3333740234375,"y":211.1197509765625,"wires":[]},{"id":"42d44efed110f119","type":"link out","z":"3afa3b2ec00a5e3d","g":"f819a208c9a9e301","name":"link out 2","mode":"link","links":["f38f641b0fe0202f","cd3028c339baf502","c255165743dab74e","dcfd4fec22f930eb"],"x":2092.833251953125,"y":172.91150665283203,"wires":[]},{"id":"f032986923013ead","type":"link in","z":"3afa3b2ec00a5e3d","g":"2936cc7950d10f77","name":"link in 1","links":["ca381bfca1c3a6a8"],"x":528,"y":1498.25,"wires":[["43aa4576cc0449fd"]]},{"id":"07a48d0ae3691dfd","type":"link in","z":"3afa3b2ec00a5e3d","g":"859955c795ba6c86","name":"link in 2","links":["ca381bfca1c3a6a8"],"x":923,"y":1498.625,"wires":[["74c3ab0399dc06e2"]]},{"id":"7835bb0a66ce9604","type":"link in","z":"3afa3b2ec00a5e3d","g":"34c704ff5c1978cf","name":"link in 3","links":["ca381bfca1c3a6a8"],"x":1367,"y":1497.625,"wires":[["0d8e15cfb25a1343"]]},{"id":"6dffa4232a7ec9a9","type":"link in","z":"3afa3b2ec00a5e3d","g":"fa67af97329dd415","name":"link in 4","links":["ca381bfca1c3a6a8"],"x":1773.4285888671875,"y":1498.625,"wires":[["1e697584bfe7e0b7"]]},{"id":"397ff5c6eab3be66","type":"switch","z":"3afa3b2ec00a5e3d","g":"f75f3dfd9421f0f1","name":"stop after 20k messages","property":"msgcnt","propertyType":"msg","rules":[{"t":"lt","v":"20000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":236,"y":322.4947509765625,"wires":[["d4f0e1e9a072564c"]]}]
@@ -0,0 +1 @@
1
+ [{"id":"79d0839cd7b4061d","type":"tab","label":"[supervisor] order defined by Y coordinate.","disabled":false,"info":"**NOTE**: this is used for educational purposes and will **never** be a final solution.\n\nLocational information of nodes will **never** and **should** never be a defining factor for the logic of a program or code. Visually things are connected and that defines the logical workings of a program but the position of nodes should not.\n\n*Kids: don't do this at home!*\n\n**DEPRECATED** this no longer works since the ordering of processs is now done in the supervisor itself. The 'y' coordinate does nothing, nichts, nada, nothing.\n\nI fixed this test by setting the correct order in the <a class=\"ahl-node-only\" data-ids=\"8eb034363420b0ba\">supervisor: 5</a> node.","env":[{"name":"ERED_PENDING","value":"false","type":"bool"},{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"458abbe562d49be9","type":"group","z":"79d0839cd7b4061d","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["8eb034363420b0ba","8efa1f4a5aed9db5","94f66b9d12388956","64b181cb53e6c86c","de5463924bdaac22","d907c0a4fb165a0c"],"x":778,"y":437.2039489746094,"w":369,"h":350.5000305175781},{"id":"bd184591e87e719f","type":"junction","z":"79d0839cd7b4061d","x":244.74490213394165,"y":215.71429443359375,"wires":[["20e44d61b31a7aa8"]]},{"id":"3a32b74ce99e743f","type":"junction","z":"79d0839cd7b4061d","x":1548.7756123542786,"y":215.71429443359375,"wires":[["bd184591e87e719f"]]},{"id":"87a7905c41201abc","type":"inject","z":"79d0839cd7b4061d","name":"start button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":988.857177734375,"y":834.9539184570312,"wires":[["a23d0b2316e2d68f"]]},{"id":"a23d0b2316e2d68f","type":"change","z":"79d0839cd7b4061d","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":395.857177734375,"y":973.9539184570312,"wires":[["8efa1f4a5aed9db5","c94a99bf9547c8e7","4e0bd2d67ea4b10c","f42cbc166e0293ad","64b181cb53e6c86c","94f66b9d12388956"]]},{"id":"de5463924bdaac22","type":"debug","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"debug 6","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1041,"y":746.7039794921875,"wires":[]},{"id":"c94a99bf9547c8e7","type":"delay","z":"79d0839cd7b4061d","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":394.8571548461914,"y":1069.2039456367493,"wires":[["a23d0b2316e2d68f"]]},{"id":"4e0bd2d67ea4b10c","type":"debug","z":"79d0839cd7b4061d","name":"debug 7","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":991.5714111328125,"y":912.9182739257812,"wires":[]},{"id":"df5930c0614e6a57","type":"switch","z":"79d0839cd7b4061d","name":"what status?","property":"status","propertyType":"msg","rules":[{"t":"eq","v":"dead","vt":"str"},{"t":"eq","v":"started","vt":"str"},{"t":"eq","v":"restarted","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1252.8571548461914,"y":478.20394563674927,"wires":[["87a1196be7bf4a8f","0fec0a4e2c7d03ce","301681f6cd05ca75"],["36a46b7d1034ec7b"],["c373106927a864c1"]]},{"id":"c373106927a864c1","type":"debug","z":"79d0839cd7b4061d","name":"restarted counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1578.8571548461914,"y":533.2039456367493,"wires":[]},{"id":"36a46b7d1034ec7b","type":"debug","z":"79d0839cd7b4061d","name":"started counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1568.8571548461914,"y":478.20394563674927,"wires":[]},{"id":"87a1196be7bf4a8f","type":"debug","z":"79d0839cd7b4061d","name":"dead counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1559.8571548461914,"y":419.20394563674927,"wires":[]},{"id":"0fec0a4e2c7d03ce","type":"delay","z":"79d0839cd7b4061d","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1467.285743713379,"y":296.06109285354614,"wires":[["3a32b74ce99e743f"]]},{"id":"20e44d61b31a7aa8","type":"change","z":"79d0839cd7b4061d","name":"","rules":[{"p":"action","pt":"msg","t":"set","to":"restart","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":398.57140350341797,"y":478.20394563674927,"wires":[["8eb034363420b0ba"]]},{"id":"f42cbc166e0293ad","type":"join","z":"79d0839cd7b4061d","name":"atleast","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"250","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":305.5714111328125,"y":724.632568359375,"wires":[["ab4241fce137fdb0"]]},{"id":"ab4241fce137fdb0","type":"ut-assert-success","z":"79d0839cd7b4061d","name":"","count":"0","x":298.5714111328125,"y":620.6325073242188,"wires":[]},{"id":"301681f6cd05ca75","type":"ut-assert-success","z":"79d0839cd7b4061d","name":"","count":1,"x":1558.8571548461914,"y":362.70394563674927,"wires":[]},{"id":"8eb034363420b0ba","type":"erlsupervisor","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"","scope":["64b181cb53e6c86c","d907c0a4fb165a0c","8efa1f4a5aed9db5","94f66b9d12388956","de5463924bdaac22"],"supervisor_type":"static","strategy":"rest_for_one","auto_shutdown":"never","intensity":"5","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"","x":950.857177734375,"y":478.2039489746094,"wires":[["df5930c0614e6a57"]]},{"id":"8efa1f4a5aed9db5","type":"function","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"exit call","func":"exit(self(),failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":864,"y":653.1019897460938,"wires":[[]]},{"id":"94f66b9d12388956","type":"function","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"function 3","func":"maps:put(hello,world,Msg)\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":864,"y":746.7039794921875,"wires":[["de5463924bdaac22"]]},{"id":"d907c0a4fb165a0c","type":"debug","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"debug 1","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1041,"y":559.5,"wires":[]},{"id":"64b181cb53e6c86c","type":"function","z":"79d0839cd7b4061d","g":"458abbe562d49be9","name":"function 1","func":"maps:put(hello,world,Msg)\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":864,"y":559.5,"wires":[["d907c0a4fb165a0c"]]}]
@@ -0,0 +1 @@
1
+ [{"id":"6b22ce2a482c2d6d","type":"tab","label":"[supervisor] restart after exit call","disabled":false,"info":"<small><i>[Share Link](https://flows.red-erik.org/f/6b22ce2a482c2d6d)</i></small>\n\n## Restart supervisor via message\n\nHere the <a class=\"ahl-node-only\" data-ids=\"021e749ad389ab88\">supervisor</a> is supervising two function nodes, <a class=\"ahl-node-only\" data-ids=\"874cb18b3842747d\">one</a> of which exits each time it receives a message. The <a class=\"ahl-node-only\" data-ids=\"84927e2b99bfc27b\">second</a> function node passes the message through, unaltered.\n\nA <a class=\"ahl-group-only\" data-ids=\"eb4c717d536bec97\">message generator</a> sends both function nodes a continous stream of messages. Messages are five milliseconds apart, two hundred messages per second.\n\nThe configuration of the <a class=\"ahl-node-only\" data-ids=\"021e749ad389ab88\">supervisor</a> is intensity of 5 over a period of 30 seconds. Meaning the functions node can fail up to five times in a thirty second period.\n\nThe <a class=\"ahl-node-only\" data-ids=\"874cb18b3842747d\">exit call</a> function fails *each* time it receives a message, meaning it fails 5 times in 25 *milli*seconds, after 30 milliseconds the <a class=\"ahl-node-only\" data-ids=\"021e749ad389ab88\">supervisor</a> also fails, taking with it the second <a class=\"ahl-node-only\" data-ids=\"84927e2b99bfc27b\">function</a> node.\n\n\nThat is way the <a class=\"ahl-node-only\" data-ids=\"1ea63df69490f4db\">debug message counter</a> is incremented in blocks of six, because the <a class=\"ahl-node-only\" data-ids=\"84927e2b99bfc27b\">function 2</a> passes through the first six messages, then dies, gets restarted and passes through another six messages.\n\n![img](https://cdn.openmindmap.org/content/1748524763647_erlang-red-supervisor3.gif)\n\n\nWhen the <a class=\"ahl-node-only\" data-ids=\"021e749ad389ab88\">supervisor</a> fails, it sends a message to the <a class=\"ahl-node-only\" data-ids=\"29503cddc16de778\">what status?</a> switch node that, if the status of the supervisor is `dead` then directs the message along the <a class=\"ahl-group-only\" data-ids=\"e1a45cd7394adb90\">restart path</a>.\n\nThe message is <a class=\"ahl-node-only\" data-ids=\"efac69a788e070b5\">delayed by 2s</a> and the <a class=\"ahl-node-only\" data-ids=\"8277b19f347ddcfb\">set msg.action</a> to `restart` before being passed to the supervisor. It then restarts just to fail again after 30 milliseconds.\n\n## Supervisor to supervise a Supervisor\n\nIt is also possible to use a supervisor node to restart a supervisor, that is demonstrated by this [flow](https://flows.red-erik.org/f/e447b0048a5983b5).\n\n","env":[{"name":"ERED_TIMEOUT","value":"9","type":"num"},{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"abf8c9a905272f8e","type":"group","z":"6b22ce2a482c2d6d","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["021e749ad389ab88","874cb18b3842747d","84927e2b99bfc27b"],"x":925,"y":404,"w":272,"h":528.5714285714286},{"id":"eb4c717d536bec97","type":"group","z":"6b22ce2a482c2d6d","name":"message generator","style":{"label":true},"nodes":["00404d33057120fb","b1e8a05edf9a1f49","fa84ecd4d8a1c08d"],"x":164,"y":746.75,"w":531,"h":190.25},{"id":"e1a45cd7394adb90","type":"group","z":"6b22ce2a482c2d6d","name":"restart path","style":{"label":true},"nodes":["efac69a788e070b5","8277b19f347ddcfb","b14c6de25717ff89","35f156dc1adffb2e"],"x":737.2055430412292,"y":191.22167646884918,"w":823.7129144668579,"h":154.77832353115082},{"id":"b14c6de25717ff89","type":"junction","z":"6b22ce2a482c2d6d","g":"e1a45cd7394adb90","x":763.2055430412292,"y":217.22167646884918,"wires":[["8277b19f347ddcfb"]]},{"id":"35f156dc1adffb2e","type":"junction","z":"6b22ce2a482c2d6d","g":"e1a45cd7394adb90","x":1534.9184575080872,"y":217.51034879684448,"wires":[["b14c6de25717ff89"]]},{"id":"021e749ad389ab88","type":"erlsupervisor","z":"6b22ce2a482c2d6d","g":"abf8c9a905272f8e","name":"supervisor of loving grace","scope":["874cb18b3842747d","84927e2b99bfc27b"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"5","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"","x":1061,"y":445,"wires":[["29503cddc16de778"]]},{"id":"874cb18b3842747d","type":"function","z":"6b22ce2a482c2d6d","g":"abf8c9a905272f8e","name":"exit call","func":"exit(self(), failure_of_func)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1016,"y":787.75,"wires":[[]]},{"id":"84927e2b99bfc27b","type":"function","z":"6b22ce2a482c2d6d","g":"abf8c9a905272f8e","name":"function 2","func":"maps:put(hello, world, Msg)\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1016,"y":891.5714285714286,"wires":[["f09b0ccfab4ddbf7"]]},{"id":"00404d33057120fb","type":"inject","z":"6b22ce2a482c2d6d","g":"eb4c717d536bec97","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":787.75,"wires":[["b1e8a05edf9a1f49"]]},{"id":"b1e8a05edf9a1f49","type":"change","z":"6b22ce2a482c2d6d","g":"eb4c717d536bec97","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":589,"y":787.75,"wires":[["874cb18b3842747d","fa84ecd4d8a1c08d","ad82ec4cb4957dd2","84927e2b99bfc27b","f8fb4da6c8f33c06"]]},{"id":"fa84ecd4d8a1c08d","type":"delay","z":"6b22ce2a482c2d6d","g":"eb4c717d536bec97","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":592,"y":896,"wires":[["b1e8a05edf9a1f49"]]},{"id":"ad82ec4cb4957dd2","type":"debug","z":"6b22ce2a482c2d6d","name":"debug 5","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":795.7142715454102,"y":727.7143077850342,"wires":[]},{"id":"29503cddc16de778","type":"switch","z":"6b22ce2a482c2d6d","name":"what status?","property":"status","propertyType":"msg","rules":[{"t":"eq","v":"dead","vt":"str"},{"t":"eq","v":"started","vt":"str"},{"t":"eq","v":"restarted","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1290,"y":445,"wires":[["5e74391f2b90b291","efac69a788e070b5","eaf756cb0b4d0e61"],["2c111f28540619e3"],["4a7406140d09ceb3"]]},{"id":"4a7406140d09ceb3","type":"debug","z":"6b22ce2a482c2d6d","name":"restarted counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1617,"y":555,"wires":[]},{"id":"2c111f28540619e3","type":"debug","z":"6b22ce2a482c2d6d","name":"started counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1607,"y":500,"wires":[]},{"id":"5e74391f2b90b291","type":"debug","z":"6b22ce2a482c2d6d","name":"dead counter","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1597,"y":441,"wires":[]},{"id":"efac69a788e070b5","type":"delay","z":"6b22ce2a482c2d6d","g":"e1a45cd7394adb90","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1453.4285888671875,"y":297.8571472167969,"wires":[["35f156dc1adffb2e"]]},{"id":"8277b19f347ddcfb","type":"change","z":"6b22ce2a482c2d6d","g":"e1a45cd7394adb90","name":"","rules":[{"p":"action","pt":"msg","t":"set","to":"restart","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":885.7142333984375,"y":305,"wires":[["021e749ad389ab88"]]},{"id":"7a6ae313d3d52f28","type":"ut-assert-success","z":"6b22ce2a482c2d6d","name":"","count":"0","x":803.7142944335938,"y":621.4285888671875,"wires":[]},{"id":"eaf756cb0b4d0e61","type":"ut-assert-success","z":"6b22ce2a482c2d6d","name":"","count":1,"x":1597,"y":384.5,"wires":[]},{"id":"f8fb4da6c8f33c06","type":"join","z":"6b22ce2a482c2d6d","name":"","mode":"custom","build":"array","property":"payload","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"250","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":787,"y":681,"wires":[["7a6ae313d3d52f28"]]},{"id":"f09b0ccfab4ddbf7","type":"join","z":"6b22ce2a482c2d6d","name":"","mode":"custom","build":"array","property":"payload","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"7","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1270,"y":891.5714285714286,"wires":[["70857ba136d3d197"]]},{"id":"70857ba136d3d197","type":"ut-assert-failure","z":"6b22ce2a482c2d6d","name":"","x":1597,"y":891.5714285714286,"wires":[]}]
@@ -0,0 +1 @@
1
+ [{"id":"d6c796491294233e","type":"tab","label":"[supervisor] supervising two function nodes","disabled":false,"info":"Simple exampe of using the supervisor node to revive a function node that dies because it does a divide by zero.\n\nThe inject node can be pressed five times[1] and after the supervisor dies - check the configuration of the supervisor node for why this happens.\n\nThe <a class=\"ahl-node-only\" data-ids=\"3c8c8d8fa8232bc4\">delay 500ms</a> node is there to ensure that the message goes through to the <a class=\"ahl-node-only\" data-ids=\"96713a5958600f3b\">Assert True</a> node before the <a class=\"ahl-node-only\" data-ids=\"66a17d54fe9f3bdd\">function 1</a> node is restarted because the divide by zero error <a class=\"ahl-node-only\" data-ids=\"373d6e3f9b852130\">node</a> fails.\n\n*NOTE* Not run as eunit test because it produces error messages about supervisors crashing - something that is meant to happen.\n\n[1]: Move a node, deploy the flow and then it's started. Inject button then has an affect.","env":[{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_TIMEOUT","value":"4","type":"num"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"4c3356e96385c30b","type":"group","z":"d6c796491294233e","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["373d6e3f9b852130","66a17d54fe9f3bdd","7415aceb164005dd"],"x":469,"y":405.16668701171875,"w":232,"h":284.83331298828125},{"id":"373d6e3f9b852130","type":"function","z":"d6c796491294233e","g":"4c3356e96385c30b","name":"divide by zero error","func":"ered_nodered_comm:post_exception_or_debug(NodeDef, Msg, <<\"divide by zero\">>),\n1 / 0","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":585,"y":501.25,"wires":[["3f010ba469a458a6"]]},{"id":"ca0b875d707b9b25","type":"inject","z":"d6c796491294233e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":172,"y":649,"wires":[["66a17d54fe9f3bdd","3c8c8d8fa8232bc4"]]},{"id":"66a17d54fe9f3bdd","type":"function","z":"d6c796491294233e","g":"4c3356e96385c30b","name":"function 1","func":"maps:put(<<\"hello\">>,world,Msg)\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":585,"y":649,"wires":[["96713a5958600f3b"]]},{"id":"3f010ba469a458a6","type":"ut-assert-failure","z":"d6c796491294233e","name":"","x":834,"y":501.25,"wires":[]},{"id":"96713a5958600f3b","type":"ut-assert-success","z":"d6c796491294233e","name":"","count":1,"x":834,"y":649,"wires":[]},{"id":"33074a4c0243ec99","type":"catch","z":"d6c796491294233e","name":"","scope":["373d6e3f9b852130"],"uncaught":false,"x":298,"y":174,"wires":[["bf4ae0b0a489befb"]]},{"id":"bf4ae0b0a489befb","type":"ut-assert-success","z":"d6c796491294233e","name":"","count":1,"x":834,"y":174,"wires":[]},{"id":"079a3c0e58372482","type":"switch","z":"d6c796491294233e","name":"supervisor dead?","property":"status","propertyType":"msg","rules":[{"t":"eq","v":"dead","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":854,"y":353.25,"wires":[["b69e93448c758331"]]},{"id":"b69e93448c758331","type":"delay","z":"d6c796491294233e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":585,"y":258.25,"wires":[["f085471e5c4dc05e"]]},{"id":"f085471e5c4dc05e","type":"change","z":"d6c796491294233e","name":"","rules":[{"p":"action","pt":"msg","t":"set","to":"restart","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":323,"y":353.25,"wires":[["7415aceb164005dd"]]},{"id":"7415aceb164005dd","type":"erlsupervisor","z":"d6c796491294233e","g":"4c3356e96385c30b","name":"","scope":["373d6e3f9b852130","66a17d54fe9f3bdd"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"5","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":586.6666870117188,"y":446.16668701171875,"wires":[["079a3c0e58372482"]]},{"id":"3c8c8d8fa8232bc4","type":"delay","z":"d6c796491294233e","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":371,"y":562,"wires":[["373d6e3f9b852130"]]}]
@@ -0,0 +1 @@
1
+ [{"id":"cb538fcaaab76178","type":"tab","label":"[supervisor] supervisor loops","disabled":false,"info":"<small><i>[Share Link](https://flows.red-erik.org/f/cb538fcaaab76178)</i></small>\n\n## Supervisor loops\n\nSupervisor loops are not possible and Erlang-Red should error out.\n\n![img](https://cdn.openmindmap.org/content/1748870779411_Screenshot_2025-06-02_at_15.26.10.png)\n\nThis this flow the <a class=\"ahl-node-only\" data-ids=\"6aed3a08befb93aa\">first supervisor</a> is the supervisor of the <a class=\"ahl-node-only\" data-ids=\"bf3c14de41930be2\">second supervisor</a> which in turn is the supervisor of the <a class=\"ahl-node-only\" data-ids=\"923a99213caa43c4\">third supervisor</a> which is the supervisor of the <a class=\"ahl-node-only\" data-ids=\"a0451f2d039d8778\">fourth supervisor</a>, the <a class=\"ahl-node-only\" data-ids=\"19d8f8c07a31296c\">debug 2</a> node and the <a class=\"ahl-node-only\" data-ids=\"6b5f9bcec32f2b8b\">exit on message</a> function node.\n\nThat structure would be perfectly ok it weren't for the fact that the <a class=\"ahl-node-only\" data-ids=\"a0451f2d039d8778\">fourth supervisor</a> is also the supervisor of the <a class=\"ahl-node-only\" data-ids=\"6aed3a08befb93aa\">first supervisor</a> and that closes the loop.\n\nThis structure is not possible because it could well lead to an loop of restarts and failures or restarts of restarts.\n\n\n","env":[{"name":"ERED_TIMEOUT","value":"5","type":"num"},{"name":"ERED_PENDING","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"923a99213caa43c4","type":"erlsupervisor","z":"cb538fcaaab76178","name":"third supervisor","scope":["6b5f9bcec32f2b8b","19d8f8c07a31296c","a0451f2d039d8778"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"52","period":"20","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":1320.0000762939453,"y":324.3333535194397,"wires":[[]]},{"id":"6b5f9bcec32f2b8b","type":"function","z":"cb538fcaaab76178","name":"exit on message","func":"exit(self(), normal)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1304.3334121704102,"y":401.66663932800293,"wires":[[]]},{"id":"fdd041cfd080c1d7","type":"inject","z":"cb538fcaaab76178","name":"Start Button","props":[{"p":"payload"},{"p":"msgcnt","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":442.00000762939453,"y":408.33337593078613,"wires":[["aba46d81a0c32892"]]},{"id":"aba46d81a0c32892","type":"change","z":"cb538fcaaab76178","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"},{"p":"msgcnt","pt":"msg","t":"set","to":"$$.msgcnt + 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":647.3333511352539,"y":452.04089546203613,"wires":[["a276f161c4527b56","6b5f9bcec32f2b8b","5dc57e099c2e0630"]]},{"id":"a276f161c4527b56","type":"delay","z":"cb538fcaaab76178","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":839.333381652832,"y":526.4158954620361,"wires":[["85cd42cbfa36fb5d"]]},{"id":"85cd42cbfa36fb5d","type":"switch","z":"cb538fcaaab76178","name":"stop after 2000 messages","property":"msgcnt","propertyType":"msg","rules":[{"t":"lt","v":"2000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":420.9999771118164,"y":529.4158954620361,"wires":[["aba46d81a0c32892"]]},{"id":"6aed3a08befb93aa","type":"erlsupervisor","z":"cb538fcaaab76178","name":"first supervisor","scope":["bf3c14de41930be2"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1000","period":"1","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":1073.3332061767578,"y":243.3333158493042,"wires":[[]]},{"id":"bf3c14de41930be2","type":"erlsupervisor","z":"cb538fcaaab76178","name":"second supervisor","scope":["923a99213caa43c4"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"30","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":1320.9997940063477,"y":242.66665649414062,"wires":[[]]},{"id":"a0451f2d039d8778","type":"erlsupervisor","z":"cb538fcaaab76178","name":"fourth supervisor","scope":["6aed3a08befb93aa"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"5","child_type":"worker","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":1088.666374206543,"y":328.9999294281006,"wires":[[]]},{"id":"5dc57e099c2e0630","type":"ut-assert-success","z":"cb538fcaaab76178","name":"","count":"2000","x":848.5714285714284,"y":322.85714285714283,"wires":[]}]
@@ -0,0 +1 @@
1
+ [{"id":"e447b0048a5983b5","type":"tab","label":"[supervisor] supervisor of supervisor of supervisor of ....","disabled":false,"info":"<small><i>[Share link](https://flows.red-erik.org/f/e447b0048a5983b5)</i></small>\n\n## Supervisors all the way down\n\nAn example of using supervisors to restart supervisors. This supercedes the [restart via message](https://flows.red-erik.org/f/6b22ce2a482c2d6d) or rather provides a simpler mechansim for restarting a supervisor. Both approaches are supported.\n\n## Setup\n\nThe core of this flow is the <a class=\"ahl-group-only\" data-ids=\"e1745dfaec070457\">root group</a> that contains the <a class=\"ahl-node-only\" data-ids=\"f9c30facfa98c063\">root supervisor</a> which is the last in a chain of supervisors. The root supervisor has an intensity of 1000 over a period of 1 second, i.e., it is designed to never fail.\n\nThe root supervisor supervises the <a class=\"ahl-node-only\" data-ids=\"b3e3826d7586da51\">one below root</a> supervisor that in turn supervises the <a class=\"ahl-node-only\" data-ids=\"c948d78b56ea338f\">two below root</a> supervisor which in turn supervises the <a class=\"ahl-node-only\" data-ids=\"49f8266870cf3ae4\">three below root</a> which finally supervises the <a class=\"ahl-node-only\" data-ids=\"0a384e288df2f95d\">supervisor controlling function node</a>.\n\nEach supervisor has an intensity and period configuration such that they eventually die and need to be restated by a supervisor. So it goes all the way up to the <a class=\"ahl-node-only\" data-ids=\"f9c30facfa98c063\">root supervisor</a> that ends up restarting the entire chain.\n\nThe node causing the failure is the <a class=\"ahl-node-only\" data-ids=\"ce7ad9dda79c3129\">function 1</a> which contains the single line of Erlang code: `exit(self(), failure)`.\n\n**Note**: each supervisor is set to restart policy of `permanent`.\n\nThe function node receives messages from the <a class=\"ahl-group-only\" data-ids=\"9f3b6edc8707cca5\">message generation</a> group that generates 2000 messages, all of which sent to the function and each time the function exits.\n\nThat exit also takes out the <a class=\"ahl-node-only\" data-ids=\"5208e18f1c766f81\">debug 11</a> node that is also supervised by the <a class=\"ahl-node-only\" data-ids=\"0a384e288df2f95d\">supervisor controlling function</a> node. That is way the debug message counter - as shown in the animation - never goes beyond 6 because the supervisor is configured with an intensity of five over a period of ten seconds. \n\n![img](https://cdn.openmindmap.org/content/1748511273753_erlang-red-super-of-super.gif)\n\nRemember the debug node is not restarted along with the function node because the <a class=\"ahl-node-only\" data-ids=\"0a384e288df2f95d\">supervisor controlling function node</a> is configured with a restart strategy `one-for-one` but because the supervisor falls down, the debug node is always restarted once the supervisor is restarted - hence the message counter reaches six. Also the sixth message kills the supervisor because the function is *allowed* to fail five times in ten seconds and the sixth failure causes the supervisor to collapse (in a smouldering heap of burning bits).\n\nIf the supervisor where to be configured with a restart strategy of `one-for-all`, then the message counter of the <a class=\"ahl-node-only\" data-ids=\"5208e18f1c766f81\">debug 11</a> would not go beyond 1 since the supervisor would also restart the debug node when it restarted the function node, i.e., on every message.\n\n## Testing \n\nThis flow also tests that features are working. For that there are two test groups: \n\n- <a class=\"ahl-group-only\" data-ids=\"dc497ddceb8383d6\">test that everything gets restarted</a> which ensures that supervisors are doing their job. What happens is that each join collects a number of messages before emitting one bundle of messages, this test then ensures that supervisors are restarting ofren enough. Each supervisor emits a message when it falls down, when it restarts and when it has started - these messages are being collected by the <a class=\"ahl-node-only\" data-ids=\"e57a8a3419e63a78\">join 82</a>, <a class=\"ahl-node-only\" data-ids=\"ecc61f0aaeff8032\">join 166</a> and <a class=\"ahl-node-only\" data-ids=\"f0249c7f877f7d7a\">join 332</a> nodes. The <a class=\"ahl-node-only\" data-ids=\"cd9ecea3aa8b07bc,28b2942d170ef74b,3e10f2f597dd4a09\">Assert True</a> nodes are reached once the joins emit their bundle message and the test succeeds.\n\n- <a class=\"ahl-group-only\" data-ids=\"59aa8abeaa454c6a\">test throughput on debug node</a> this ensures that the debug node is receiving all the messages even if it gets restarted. How it works is by counting the status changes of the <a class=\"ahl-node-only\" data-ids=\"5208e18f1c766f81\">debug 11</a> node using the <a class=\"ahl-node-only\" data-ids=\"f03f862514493696\">status: 1</a> node. **Note**, this only works because there is a <a class=\"ahl-node-only\" data-ids=\"095ceca669915bd5\">1ms delay</a> in message generation - else the debug node does actually drop messages, i.e., doesn't receive the message because the process has died and is being restarted. Erlang-Red does not buffer messages, it sends message to processes if these processes are alive else the messages get dropped.\n\n","env":[{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_TIMEOUT","value":"9","type":"num"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"e1745dfaec070457","type":"group","z":"e447b0048a5983b5","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["f9c30facfa98c063","d0f7c225c63f6d61"],"x":752,"y":258,"w":596,"h":646},{"id":"9f3b6edc8707cca5","type":"group","z":"e447b0048a5983b5","name":"message generation","style":{"label":true},"nodes":["73f1c7593502aba5","095ceca669915bd5","ed7c19d0f90462ed"],"x":9.999969482421875,"y":676.70751953125,"w":650.3334045410156,"h":159.375},{"id":"dc497ddceb8383d6","type":"group","z":"e447b0048a5983b5","name":"test that everything gets restarted","style":{"label":true},"nodes":["e57a8a3419e63a78","3e10f2f597dd4a09","ecc61f0aaeff8032","28b2942d170ef74b","f0249c7f877f7d7a","cd9ecea3aa8b07bc","314987cdf92caa1a","4b3260fdeeac9dd1"],"x":1397,"y":88,"w":384,"h":337},{"id":"59aa8abeaa454c6a","type":"group","z":"e447b0048a5983b5","name":"test throughput on debug node","style":{"label":true},"nodes":["f03f862514493696","0827c3cdcf01b0cc","a3cb2e180d1d3398"],"x":268,"y":61,"w":585,"h":165},{"id":"d0f7c225c63f6d61","type":"group","z":"e447b0048a5983b5","g":"e1745dfaec070457","name":"","style":{"label":true},"nodes":["b3e3826d7586da51","7ff1906324f48abf"],"x":795.8337938785553,"y":330,"w":526.1662061214447,"h":548},{"id":"7ff1906324f48abf","type":"group","z":"e447b0048a5983b5","g":"d0f7c225c63f6d61","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["c948d78b56ea338f","b70b7d859dbc5968"],"x":821.8337938785553,"y":398.5,"w":474.1662061214447,"h":453.5},{"id":"b70b7d859dbc5968","type":"group","z":"e447b0048a5983b5","g":"7ff1906324f48abf","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["49f8266870cf3ae4","4ce371d78f1421dc"],"x":847.8337938785553,"y":467,"w":422.1662061214447,"h":359},{"id":"4ce371d78f1421dc","type":"group","z":"e447b0048a5983b5","g":"b70b7d859dbc5968","style":{"color":"#a4a4a4","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","stroke":"#999999","stroke-opacity":"1"},"nodes":["0a384e288df2f95d","ce7ad9dda79c3129","5208e18f1c766f81","9e76b4cbd5c0a78c"],"x":873.8337938785553,"y":542,"w":370.1662061214447,"h":258},{"id":"9e76b4cbd5c0a78c","type":"junction","z":"e447b0048a5983b5","g":"4ce371d78f1421dc","x":899.8337938785553,"y":719.6326316595078,"wires":[["ce7ad9dda79c3129","5208e18f1c766f81"]]},{"id":"f9c30facfa98c063","type":"erlsupervisor","z":"e447b0048a5983b5","g":"e1745dfaec070457","name":"root supervisor","scope":["b3e3826d7586da51"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1000","period":"1","child_type":"supervisor","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":858,"y":299,"wires":[["314987cdf92caa1a"]]},{"id":"b3e3826d7586da51","type":"erlsupervisor","z":"e447b0048a5983b5","g":"d0f7c225c63f6d61","name":"one below root","scope":["c948d78b56ea338f"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"1","child_type":"supervisor","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":918,"y":371,"wires":[["e57a8a3419e63a78"]]},{"id":"c948d78b56ea338f","type":"erlsupervisor","z":"e447b0048a5983b5","g":"7ff1906324f48abf","name":"two below root","scope":["49f8266870cf3ae4"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"6","child_type":"supervisor","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":946,"y":439.5,"wires":[["ecc61f0aaeff8032"]]},{"id":"49f8266870cf3ae4","type":"erlsupervisor","z":"e447b0048a5983b5","g":"b70b7d859dbc5968","name":"three below root","scope":["0a384e288df2f95d"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"10","child_type":"supervisor","child_restart":"permanent","child_shutdown":"infinite","child_shutdown_timeout":"0","x":978,"y":508,"wires":[["f0249c7f877f7d7a"]]},{"id":"0a384e288df2f95d","type":"erlsupervisor","z":"e447b0048a5983b5","g":"4ce371d78f1421dc","name":"supervisor controlling function node","scope":["ce7ad9dda79c3129","5208e18f1c766f81"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"5","period":"10","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1068,"y":583,"wires":[[]]},{"id":"ce7ad9dda79c3129","type":"function","z":"e447b0048a5983b5","g":"4ce371d78f1421dc","name":"function 1","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n exit(self(), failure)\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1068,"y":675,"wires":[[]]},{"id":"86123a4378f7fe05","type":"inject","z":"e447b0048a5983b5","name":"Start Button","props":[{"p":"payload"},{"p":"msgcnt","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":156,"y":446,"wires":[["73f1c7593502aba5"]]},{"id":"73f1c7593502aba5","type":"change","z":"e447b0048a5983b5","g":"9f3b6edc8707cca5","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"},{"p":"msgcnt","pt":"msg","t":"set","to":"$$.msgcnt + 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":372.3333435058594,"y":717.70751953125,"wires":[["095ceca669915bd5","9e76b4cbd5c0a78c","35309d41a6ba48c7","154c53ab47611271"]]},{"id":"095ceca669915bd5","type":"delay","z":"e447b0048a5983b5","g":"9f3b6edc8707cca5","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":564.3333740234375,"y":792.08251953125,"wires":[["ed7c19d0f90462ed"]]},{"id":"ed7c19d0f90462ed","type":"switch","z":"e447b0048a5983b5","g":"9f3b6edc8707cca5","name":"stop after 2000 messages","property":"msgcnt","propertyType":"msg","rules":[{"t":"lt","v":"2000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":145.99996948242188,"y":795.08251953125,"wires":[["73f1c7593502aba5"]]},{"id":"5208e18f1c766f81","type":"debug","z":"e447b0048a5983b5","g":"4ce371d78f1421dc","name":"debug 11","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":1072,"y":759,"wires":[]},{"id":"f03f862514493696","type":"status","z":"e447b0048a5983b5","g":"59aa8abeaa454c6a","name":"","scope":["5208e18f1c766f81"],"x":354,"y":185,"wires":[["0827c3cdcf01b0cc","1c538e85c7a78e99"]]},{"id":"e57a8a3419e63a78","type":"join","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"atleast","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"82","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1483,"y":214,"wires":[["3e10f2f597dd4a09"]]},{"id":"3e10f2f597dd4a09","type":"ut-assert-success","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"","count":1,"x":1665,"y":214,"wires":[]},{"id":"ecc61f0aaeff8032","type":"join","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"atleast","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"166","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1493,"y":299,"wires":[["28b2942d170ef74b"]]},{"id":"28b2942d170ef74b","type":"ut-assert-success","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"","count":1,"x":1665,"y":299,"wires":[]},{"id":"f0249c7f877f7d7a","type":"join","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"atleast","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"332","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1493,"y":384,"wires":[["cd9ecea3aa8b07bc"]]},{"id":"cd9ecea3aa8b07bc","type":"ut-assert-success","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"","count":1,"x":1665,"y":384,"wires":[]},{"id":"0827c3cdcf01b0cc","type":"join","z":"e447b0048a5983b5","g":"59aa8abeaa454c6a","name":"atleast","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"1900","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":556,"y":102,"wires":[["a3cb2e180d1d3398"]]},{"id":"a3cb2e180d1d3398","type":"ut-assert-success","z":"e447b0048a5983b5","g":"59aa8abeaa454c6a","name":"","count":1,"x":737,"y":102,"wires":[]},{"id":"314987cdf92caa1a","type":"join","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"no more","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1483,"y":129,"wires":[["4b3260fdeeac9dd1"]]},{"id":"4b3260fdeeac9dd1","type":"ut-assert-failure","z":"e447b0048a5983b5","g":"dc497ddceb8383d6","name":"","x":1665,"y":129,"wires":[]},{"id":"154c53ab47611271","type":"ut-assert-success","z":"e447b0048a5983b5","name":"","count":"2000","x":622.8571548461914,"y":589.9999656677246,"wires":[]},{"id":"35309d41a6ba48c7","type":"debug","z":"e447b0048a5983b5","name":"debug 10","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":552.3333740234375,"y":428,"wires":[]},{"id":"1c538e85c7a78e99","type":"debug","z":"e447b0048a5983b5","name":"debug 1","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":551,"y":364,"wires":[]}]
@@ -0,0 +1 @@
1
+ [{"id":"6ec0c8870821dd63","type":"tab","label":"[supervisor] supervisor told to stop","disabled":false,"info":"## Supervisor of Supervisor pattern but Supervisor told to stop\n\nA failed function causes the stopping of a Supervisor node.\n\nWhat is being tested is whether a supervisor node also shuts down its children if its told to shut down.\n\n## Setup\n\n<a class=\"ahl-group-only\" data-ids=\"8888af65a8124288\">Message generator</a> generates two thousand messages. On each message, the <a class=\"ahl-node-only\" data-ids=\"d91c3d741e4de4e4\">immediate exit on message</a> function node fails causing its supervisor, the <a class=\"ahl-node-only\" data-ids=\"10639227f336a097\">supervisor - one-for-all</a> to restart the <a class=\"ahl-node-only\" data-ids=\"23a54af76e9c10a5\">delegate delegate supervisor</a> as the restart policy is `one-for-all`.\n\nThe <a class=\"ahl-node-only\" data-ids=\"23a54af76e9c10a5\">delegate delegate supervisor</a> is in charge of the <a class=\"ahl-node-only\" data-ids=\"8c14e760dcfb8a30\">function 4</a> and <a class=\"ahl-node-only\" data-ids=\"6b0a05f3bf443478\">function 5</a> nodes. These are stopped when the <a class=\"ahl-node-only\" data-ids=\"23a54af76e9c10a5\">delegate delegate supervisor</a> is stopped.\n\nAt the end of the, a <a class=\"ahl-node-only\" data-ids=\"ad54fc1b6369b67c\">join 12</a> node is collecting together messages and sends out one new message once it has twelve messages. The <a class=\"ahl-node-only\" data-ids=\"a553ec7831d634cf\">Assert True</a> node ensures this happens. \n\nThe <a class=\"ahl-node-only\" data-ids=\"8332808443914f76\">join 13</a> node does the same but collects thirteen messages but thirteen messages are never collected because the supervisor tree shuts down before that happens.\n\nThat is becausae <a class=\"ahl-node-only\" data-ids=\"10639227f336a097\">supervisor - one-for-all</a> has an intenisty of 5 over 30 seconds. Our message generator is generating a message every milliseconds, so in 30 seconds its about 30 thousand messages.\n\nHence the supervisor dies on the sixth message. It gets restarted by the <a class=\"ahl-node-only\" data-ids=\"76ecfec8634cfaa2\">root supervisor</a> but it has an intenisty of 1 over 5 seconds. That means it restarts the <a class=\"ahl-node-only\" data-ids=\"10639227f336a097\">supervisor - one-for-all</a> only once before it dies.\n\nHence only 12 messages get through at the bottom of the tree.\n\nP.S. Because of timings and process coordination, the actual number of messages that get through ranges between 10 and 12 but never thirteen, hence this test is built for this.\n\n## Supervision tree\n\n```mermaid\n%% change this to LR Node-RED like UML\ngraph TB\n30d125fb8f0bf61e@{ shape: \"rect\", label: \"root supervisor\" } --> 7f4686d2611f0e7f@{ shape: \"rect\", label: \"supervisor - one-for-all\" }\n7f4686d2611f0e7f@{ shape: \"rect\", label: \"supervisor - one-for-all\" } --> a430a1c9ee80461d@{ shape: \"rect\", label: \"delegate delegate supervisor\" }\n7f4686d2611f0e7f@{ shape: \"rect\", label: \"supervisor - one-for-all\" } --> b824c1367a13ab7c@{ shape: \"fr-rect\", label: \"immediate exit on message\" }\na430a1c9ee80461d@{ shape: \"rect\", label: \"delegate delegate supervisor\" } --> 21a4bb05caaf505c@{ shape: \"fr-rect\", label: \"function 4\" }\na430a1c9ee80461d@{ shape: \"rect\", label: \"delegate delegate supervisor\" } --> 208eafc5ccf9d41c@{ shape: \"fr-rect\", label: \"function 5\" }\n```","env":[{"name":"ERED_TIMEOUT","value":"6","type":"num"},{"name":"ERED_NOT_EUNIT","value":"true","type":"bool"},{"name":"ERED_ONLY","value":"true","type":"bool"}]},{"id":"8888af65a8124288","type":"group","z":"6ec0c8870821dd63","name":"message generation","style":{"label":true},"nodes":["df2d629bd128f867","5548fa01589ebce1","24a06060a85b8d53"],"x":130.6666259765625,"y":378.678594827652,"w":650.3334045410156,"h":160.36309218406677},{"id":"10639227f336a097","type":"erlsupervisor","z":"6ec0c8870821dd63","name":"supervisor - one-for-all","scope":["d91c3d741e4de4e4","23a54af76e9c10a5"],"supervisor_type":"static","strategy":"one_for_all","auto_shutdown":"never","intensity":"5","period":"30","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1287.2856674194336,"y":300.5714225769043,"wires":[[]]},{"id":"d91c3d741e4de4e4","type":"function","z":"6ec0c8870821dd63","name":"immediate exit on message","func":"exit(self(), failure)","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1042.9999389648438,"y":419.678594827652,"wires":[["33d1c8fe5c3f3cf8"]]},{"id":"23a54af76e9c10a5","type":"erlsupervisor","z":"6ec0c8870821dd63","name":"delegate delegate supervisor","scope":["8c14e760dcfb8a30","6b0a05f3bf443478"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"5","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1500.714225769043,"y":419.678594827652,"wires":[[]]},{"id":"8c14e760dcfb8a30","type":"function","z":"6ec0c8870821dd63","name":"function 4","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n Msg\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1401.5713081359863,"y":525.3214206695557,"wires":[["6b0a05f3bf443478"]]},{"id":"6b0a05f3bf443478","type":"function","z":"6ec0c8870821dd63","name":"function 5","func":"%% Code here is wrapped in a fun (Msg) call\n%% fun (Msg) ->\n Msg\n%% end.\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1622.9284706115723,"y":525.3214206695557,"wires":[["fc37dbca860bf3ae"]]},{"id":"76ecfec8634cfaa2","type":"erlsupervisor","z":"6ec0c8870821dd63","name":"root supervisor","scope":["10639227f336a097"],"supervisor_type":"static","strategy":"one_for_one","auto_shutdown":"never","intensity":"1","period":"5","child_type":"worker","child_restart":"permanent","child_shutdown":"brutal_kill","child_shutdown_timeout":"0","x":1281.1428298950195,"y":156.5714569091797,"wires":[[]]},{"id":"33d1c8fe5c3f3cf8","type":"ut-assert-failure","z":"6ec0c8870821dd63","name":"","x":1291.857089996338,"y":419.678594827652,"wires":[]},{"id":"df2d629bd128f867","type":"change","z":"6ec0c8870821dd63","g":"8888af65a8124288","name":"","rules":[{"p":"payload","pt":"msg","t":"set","to":"","tot":"date"},{"p":"msgcnt","pt":"msg","t":"set","to":"$$.msgcnt + 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":493,"y":419.678594827652,"wires":[["5548fa01589ebce1","d91c3d741e4de4e4","8c14e760dcfb8a30","c7753da3244b0bb5"]]},{"id":"5548fa01589ebce1","type":"delay","z":"6ec0c8870821dd63","g":"8888af65a8124288","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":685.0000305175781,"y":495.04168701171875,"wires":[["24a06060a85b8d53"]]},{"id":"24a06060a85b8d53","type":"switch","z":"6ec0c8870821dd63","g":"8888af65a8124288","name":"stop after 2000 messages","property":"msgcnt","propertyType":"msg","rules":[{"t":"lt","v":"2000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":266.6666259765625,"y":498.04168701171875,"wires":[["df2d629bd128f867"]]},{"id":"3ef7c89152d98002","type":"inject","z":"6ec0c8870821dd63","name":"","props":[{"p":"msgcnt","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":278,"y":313,"wires":[["df2d629bd128f867"]]},{"id":"fc37dbca860bf3ae","type":"ut-assert-success","z":"6ec0c8870821dd63","name":"","count":"0","x":1854.2856330871582,"y":525.3214206695557,"wires":[]},{"id":"c7753da3244b0bb5","type":"ut-assert-success","z":"6ec0c8870821dd63","name":"","count":"2000","x":1019.5,"y":523,"wires":[]}]