Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Elixir, are dependent applications supervised?

So far, I know that when I start my Elixir application, a bunch of dependent applications also get started.

Are these dependent applications started inside my app supervision tree somehow?

What happens if a dependent application crashes? Is it restarted?

like image 600
Jesse Shieh Avatar asked Sep 02 '25 02:09

Jesse Shieh


1 Answers

I guess that Elixir works like Erlang for application.

  • In Erlang each application have an independent supervision tree
  • If an application crashes, this means that the topmost supervisor did crash, and that all the restart strategy failed. There is few chance that simply adding a new layer of supervision will solve the problem.
  • it is possible to start all the dependencies using application:ensure_all_started(Application[,StartType]), StartType can be either
    • temporary : (default value): nothing occurs if a temporary application stops for any reason
    • permanent : all other applications terminate if a permanent application stops for any reason
    • transient : all other applications terminate is a transient application stops for any reason but normal
  • it is also possible to call application:ensure_started(Application[,StartType]) for each dependencies. Note that in both cases, the StartType only controls the effect of one application termination on the others, but there is no restart strategy applied.
  • it is possible to know which applications are running using application:which_applications()
like image 108
Pascal Avatar answered Sep 04 '25 23:09

Pascal