<div dir="ltr">Hi Martin,<div><br></div><div>It sounds like you need either to use either registered names, process groups, or the one_for_all strategy. Registered processes are the easiest way, you can simply refer to them by the atom -- but you must expect that sometimes messages will be lost if the process is restarting. Alternately, if you change this supervisor's strategy to one_for_all you will ensure that every process always has the correct state (assuming it already starts up in the correct state), but existing work from non-failed processes can be lost. For process groups, you can use pg2 [1] which comes with OTP, or there are several alternate implementations available on github, but messaging the other processes in this small group will incur additional overhead.</div><div><br></div><div>Each solution has tradeoffs, I hope that helps you decide which one to use.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 28, 2015 at 10:03 AM, Martin Koroudjiev <span dir="ltr"><<a href="mailto:mrtndimitrov@gmail.com" target="_blank">mrtndimitrov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I am wondering how can I get notified when a child process is restarted?<br>
Imagine this simple scenario - supervisor with one_for_one strategy and<br>
3 gen_servers as workers. Each in its state has the PIDs of the other 2<br>
and sends them messages. Now if one child gets restarted, the other 2<br>
will have the old PID. How can I notify them?<br>
<br>
I can't restart the whole supervision tree because the number of child<br>
processes is buried deep in the initialization logic of the application.<br>
<br>
Regards,<br>
Martin<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>