Chapter 4. Writing server applications with GenServer

This chapter covers

  • OTP and why you should use it
  • OTP behaviors
  • Rewriting Metex to use the GenServer OTP behavior
  • Structuring your code to use GenServer
  • Handling synchronous and asynchronous requests using callbacks
  • Managing server state
  • Cleanly stopping the server
  • Registering the GenServer with a name

In this chapter, you begin by learning about OTP. OTP originally stood for Open Telecom Platform and was coined by the marketing geniuses over at Ericsson (I hope they don’t read this!). It’s now only referred to by its acronym. Part of the reason is that the naming is myopic—the tools provided by OTP are in no way specific to the telecommunications domain. Nonetheless, the name has stuck, ...

Get The Little Elixir & OTP Guidebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.