Search⌘ K
AI Features

The Child Specification

Explore how child specifications define the behavior of supervised processes in Elixir. Understand key options like restart types, shutdown time, and start tuples. Learn to customize child specs for dynamic arguments and proper process recovery to ensure fault-tolerant applications.

We'll cover the following...

The strategies describe a lot of how a supervisor works with child processes, but they are not the whole story. There are a number of other options we can specify. Those options are stored in the child specification.

Fortunately, we don’t have too much work to do here. The GenServer Behaviour creates a default child specification for us whenever we add the use GenServer line to a module.

New IEx session

We can check the child spec for the Game module in IEx with child_spec/1, and pass it the argument we want the supervisor to use as it starts a game.

Note: Run these commands in the terminal below:

alias IslandsEngine.Game
Game.child_spec("Kusama")

A subset of the keys will actually be returned depending on ...