liveBook · Manning

Otp-compliant process

As explained in Elixir in Action, Third Edition

An OTP-compliant process is a process that follows Open Telecom Platform conventions and can participate in supervision trees with OTP-oriented lifecycle behavior.

An OTP-compliant process follows OTP conventions, participates in supervision trees, and provides richer lifecycle and error behavior than a plain process started with spawn. Production systems generally use OTP-compliant processes rather than unmanaged spawned processes. section 6.2.7 section 10.0

Common ways to run OTP-compliant processes include:

  • GenServer provides the central OTP abstraction for many stateful and message-driven processes. section 6.2.7
  • Supervisor organizes workers into restartable supervision trees. section 9.1.6
  • Registry starts compliant processes that can be placed in supervision trees. section 9.1.6
  • Task suits one-off jobs, while Agent suits simple processes whose main purpose is managing and exposing state. section 6.2.7 section 10.0
  • GenStage and Phoenix.Channel extend the pattern toward back pressure, load control, and bidirectional client communication. section 6.2.7

Choosing a supervised worker

A one-off input-processing job can run as a Task; a state manager can use an Agent; a more capable message-driven worker can use GenServer. Each can be started under supervision instead of using spawn_link directly. section 6.2.7 section 9.1.6

Figure 9.4 Supervision tree
CH09_F04_Juric3

Use the supervision-tree figure to see how compliant workers are organized and how failures are contained or propagated upward. section 9.1.6

How Elixir in Action, Third Edition covers it

How deep it goes
Defines compliance through conventions and special-message handling, while deferring low-level implementation details to Erlang documentation.
Examples
Uses GenServer, Supervisor, Registry, Task, Agent, GenStage, and Phoenix.Channel as compliant process abstractions.
What it assumes
Assumes familiarity with workers, supervisors, and supervision trees while teaching why plain spawn processes are unsuitable for production supervision.
What you can do after
Apply it via GenServer, Supervisor, Registry, Task, or Agent when selecting production-ready concurrent workers.
How it connects
Connects GenServer, Supervisor, Registry, Task, Agent, supervision trees, and fault recovery.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.