Elixir Application Start Phases — Primary & Included applications

Elixir Developer must know about application

Malreddy Ankanna
blackode
Published in
8 min readJul 21, 2022

--

This article explains Application start phases in live by creating applications and adding lines of code. At the end of this article you will learn more about the Elixir application and its start phases in depth.

At some point you will get the requirement to do certain tasks as soon as your application is started. That’s where the start phase come to action. I myself got into this requirement to explore concepts like application controller, included applications and start phases. So, I thought of sharing my ideas.

The start phases in Elixir/Erlang will do process synchronization with included applications. These start phases will ensure the main process is in sync with the included applications.

Start phases are the part of the application configuration. So, to understand this we need to understand application configuration.

What is an Application?

We write the code to do certain functions and we re use the written code to develop more functions to full fill our requirements. Now, you want to organize this into a re-usable component that can be started and stopped individually. This component is called an APPLICATION.

An application can include other applications. The primary application is responsible for starting the supervision tree for included application as it is part of the primary application and doesn’t start on its own.

Here, Elixir application is also called as Elixir library that can be published at hex.pm, the package manager for the Erlang ecosystem.

How do we configure our Elixir application?

We can configure our application by defining a function named as application/0 inside the file mix.exs that returns the keyword list.

@spec application() :: keyword
def application do
[
extra_applications: [:logger, :runtime_tools]
...
]
end

--

--

Malreddy Ankanna
blackode

Programmer & Writer, I write about coding, thoughts, ideas, personal musings, technical articles, and tutorials.https://bio.link/blackode

Recommended from Medium

Lists

See more recommendations