[erlang-questions] Adding simple process to supervisor?
Bengt Kleberg
bengt.kleberg@REDACTED
Thu Oct 9 09:03:27 CEST 2008
Greetings,
I have a gen_server which is supervised according to OTP rules. Now I
want to add a simple process that will read from a TCP port and send
the incoming data to the gen_server. I could spawn_link this process
from the gen_server and restart it if it dies. However, since I have a
supervisor it seems more logical to just add the process there, as a
rest_for_one.
There is the alternative of using a supervisor_bridge, but that seems
more complex than using the gen_server. It seems as if I just design
my process according to the OTP rules I will not need to use a
supervisor_bridge. What are those rules? The only suggestions I have
found are:
1 Module:start_link/1 => {ok, Pid}
2 Module:terminate/2 => ok
The child specification returned by the init/1 call-back in a
supervisor mentions the value for Modules if we have a gen_server,
gen_fsm or gen_event. What could be used for a simple process?
But how do I add a simple process to the supervisor? It seems overkill
to masquerade it as a get_fsm or similar. Since it is not called from
erlang it is not a gen_server. Since it does not have state it is not a
gen_fsm. No events are handled.
bengt
More information about the erlang-questions
mailing list