I try to make new supervisor for developer can easy to add & manage processes.
For current supervisors, that is based on OTP & suitable for telecom application and need to think too much for design.
I made a all in one & flat supervisor for newbies can jump and use easily.
Basic idea in here is separated process follow group/chain/standalone.
Support for add all processes from config or by runtime.
Supervisor now can work in basic, you can get it from hex.pm or access source code from Github.com
Basic example:
# Start a supervisor with 2 partitions & 2 groups:
alias SuperWorker.Supervisor, as: Sup
# Config for supervisor
opts = [id: :sup1, number_of_partitions: 2, link: false]
# Start supervisor
Sup.start(opts)
# Add group in runtime, you also can add group in config.
Sup.add_group(:sup1, [id: :group1, restart_strategy: :one_for_all])
Sup.add_group_worker(:sup1, :group1, {Dev, :task, [15]}, [id: :g1_1])
Sup.add_group(:sup1, [id: :group2, restart_strategy: :one_for_one])
Sup.add_group_worker(:sup1, :group2, fn ->
receice do
msg ->
:ok
end
end, [id: :g2_2])
I’m still working on this and update more details in later!
Sorry. I mean if you dodge lawsuits and Hex can manage umlauts, it would be a cooler name. I forget if it is Ruby that is particularly into puns when naming libraries/packages.
This looks nice, thank you. I would use the chain workers but would be worried about lack of persistence i.e. if we have a chain of 5 steps and the app is restarted while step 3 is executing, I would want step 3 to begin executing anew after the app starts again.
I realize this is no longer a “normal” supervisor logic and goes into the territory of persistent job queues. I am sharing what I would find useful.