Start and Stop Applications

Understand the details of starting and stopping applications in IslandsEngine.

Start dependency inside the BEAM

Applications are so independent, we can start and stop them individually in the BEAM. When we start an individual Application, OTP will start any necessary supervisor or worker processes with it. When we stop that same Application, OTP makes sure to stop those supervisors and workers as well.

The work of defining which processes to start comes together in the callbacks file. In the IslandsEngine project, that’s /lib/islands_engine/application.ex.

Back in Process Supervision for Recovery, we took a good look at this file in the context of supervision trees. We won’t need to go over it in much detail, but we should point out the use Application line that makes this module an Application Behaviour.

We should also quickly mention the start/2 function, which is there to start the top-level supervisor for the Application. Along the way, it makes sure that any child processes—supervisors or workers—start as well.

Get hands-on with 1400+ tech skills courses.