gen_statem and simple_one_for_one supervisor

Stanislav Ledenev s.ledenev@REDACTED
Thu Nov 26 13:00:46 CET 2020

In my application I have simple_one_for_one supervisor for handling incoming
external requests (HTTP). Each request has some command and its arguments.
Each command has its own workflow and that is why commands handler is
implemented as gen_statem. This gen_statem handles all commands and
I don't like that kind of a code mess inside of it.

I have two thoughts in my mind about resolving this problem, but I don't
them either:
1. Create multiple simple_one_for_one supervisors, one for each type of
   I don't think that so many supervisors is a good idea;
2. Create "general" gen_statem for supervisor and multiple handling modules
   which then be passed as arguments to supervisor's init.
   I don't like general over general and so on (yuck!).

Is there any elegant way to solve this kind of a problem and keep this nice
pair of simple_one_for_one supervisor and gen_statem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list