@gregoriusrippenstein/erlang-red-supervisor-node 0.4.2
Supervisor node for Erlang-RED to restart nodes that fail.
Erlang Behavioural Nodes
Note: Nodes are implemented for Erlang-Red and cannot - yet - be used with Node-RED but they can be installed in Node-RED.
What this package provides are key OTP behaviours from Erlang in a visual, Node-RED style to be used in flows to create more robust flows.
Erlang has the concept of workers and supervisors, together they build a process tree that is self-healing. Everything is process in Erlang, lightweight, independent processes is the key to Erlang.
A supervisor is designed to monitor a number of child processes (either workers or fellow supervisors) and when one or more fail, the supervisor is responsible for restarting those failed process. For more details, Erlang Documentation.
A supervisor is a behaviour and a behaviour is a definition of a generic action/workflow/activity. These nodes also implement some of the more common behaviours in Erlang:
Event handler for triggering functionality on specific events. Events are fire and forget, there is no synchronisation.
Generic Server which is probably the most common behaviour. It is important as it allows processes to have atomic state in a concurrent/parallel system.
Statemachine behaviour provides a generic approach to define clear state transitions based on actions occurring.
Erlang Module
Behaviours require modules for callbacks, that is what the module node provides. It is similar to the function node only that it provides a library of functions. Module nodes are not executed, they define code that can be used by other nodes in Erlang-Red.
Behaviour Documentation
- Event handler gen_event.
- Statemachine gen_statem.
- Generic Server gen_server.
Resources
If you are interested in learning more about the project or Erlang then check out:
- learn you some Erlang for a solid description of the core Erlang concepts
- Erlang official documentation which is high level overview of Erlang
- Erlang standard library for the APIs.
To learn more about Erlang-Red:
Artifacts for these nodes
- NPMjs Package
- Node-RED node package
- GitHub Repo
- Node-RED flow that maintains this codebase.