O'Reilly logo

Learning Elixir by Kenny Ballou

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Gen(eric) behaviours

OTP defines several generic behaviours we can use when creating Elixir applications. There is the GenServer behaviour, the GenEvent behaviour, and the :gen_fsm behaviour. All of these behaviours have their foundation in an even more general behaviour of OTP processes.

These behaviours remove some of the tedious work we had to do for handling messages and performing work that we encountered in the previous chapter.

We will start with our discussion on GenServer, and then move onto more specialized variants.

Gen(eric) servers

OTP gives us the basic blueprint for a process that receives messages, processes messages and sends a result back, like any server would.

Gen in GenServer really stands for generic or general because it provides ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required