(still updating)
Intro
Supervisor in Elixir (& Erlang) is one of interesting features of language. For legacy use case it’s enough, but it’s still limited feature for us. Based on process monitoring & linked feature of language (I have explain in this topic) we created a new supervisor for support more common case & more convenience.
Supervisor is target to easy to use, better for multi purposes.
Supervisor’s features
In one of supervisor we support:
- Group of processes
- Chain of processes
- Standalone processes
- Support partition for scalable system
Just need one supervisor in application and can add child in application module, config or in runtime (dynamic).
Better for add/remove worker in runtime.
Standalone
This type of process is designed for independent worker, it same with restart strategy :one_for_one in legacy supervisor.
group of processes
For this type of worker, all workers in a same group will have behavior like a sub supervisor. User can send a broadcast message to all workers in group.
chain of processes
For this type, worker will work like a chain with each node is a function that executed in a process. result of worker will be the first argument of next worker.
Chain: worker_1 –result1–> worker_2(result1, …) –result2–> worker_3(result2,…)
Idea of chain is same with pipe operator but each function was wrapped an run in a different process.
Community
We’re working on this library and hope I bring it to community soon!
Some code are ready for PoC, you can found at Github repo
We’re welcome Elixir developer join with us to contribute to community!
Source link
lol