[erlang-questions] How to get a worker's pid() after restarted by supervisor?

Dmitry Kolesnikov <>
Thu Aug 29 11:10:31 CEST 2013


Hello,

You have to maintain mapping of uri to pid in external table (e.g ETS)
However, there is number of open source project that addresses this issue. For example gproc by Ulf.

However, I had exactly the same task / problem like your and made a library to manage those processes. You can find it here:
http://github.com/fogfish/pts


Best Regards,
Dmitry >-|-|-*>


On 29.8.2013, at 10.03, fxmy wang <> wrote:

> 
> Hi dear fellow erlangers,
> 
> New to Erlang, I'm building a small comment backend for practice. By my design there are many worker processes that handle comments posted from different URLs, and these workers are all under simple_one_for_one supervision.
> 
> I also decide to start a dispatcher process to map certain URL comment to corresponding worker by worker_sup:start_child(URL) and then store returned Pid.
> 
> So here comes the problem, I expect that worker may be restarted by supervisor. Is there a way to get the worker's Pid after restarted by supervisor, so that I can keep track of which URL comment should go for which worker process?
> 
> Hope express myself clearly cause not a native speaker :)
> 
> B.R.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions


More information about the erlang-questions mailing list