category
category

Reputation: 2165

supervising a number of existing processes

In elixir, is there any way of supervising existing processes? Like

Supervisor.supervise_processes([pid1,pid2,...,pidn],strategy: :simple_one_for_one)

Upvotes: 0

Views: 52

Answers (1)

cdegroot
cdegroot

Reputation: 1805

No, you can't. Supervisors take specifications of processes, not processes, so they can reuse the specification over and over again to restart the process. Clearly, a process id alone is not enough data to do a restart when it dies.

Having said that - you can monitor a process and do whatever you want when you get a signal that it died.

Upvotes: 3

Related Questions