[erlang-questions] Supervisor on-demand

Andreas Hillqvist andreas.hillqvist@REDACTED
Mon Feb 25 16:45:24 CET 2008


Hi.

It sounds like simple_one_for_one would work for you.
It is possible to pass the id or any additional parameters to start_child:
   supervisor:start_child(SupRef, [YourId])


Regards
Andreas Hillqvist

2008/2/25, Juan Jose Comellas <juanjo@REDACTED>:
> I have the following scenario and I'm not really sure of how to represent it
> with OTP. I have an application (appmod) running within Yaws that has to
> create a worker process every time it receives an HTTP request.The worker
> process is created for a specific ID that comes with the request and for
> different requests that contain the same ID, the same worker process must be
> used. Once instantiated, the worker process must remain up and until it is
> explicitly stopped.
>
> I want to monitor the worker processes with an OTP supervisor, but so far
> I'm not completely sure of what the correct approach should be. Should I
> call supervisor:start_link() the first time I get a request for a specific
> ID and then supervisor:start_child() for the following ones? Or should I
> just create one supervisor process per worker process I have? Can anyone
> share some tips with me on how to design a solution for this problem within
> OTP?
>
> Thanks.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list