O'Reilly logo

Elixir Cookbook by Paulo A Pereira

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

Sending messages between processes

In Elixir, communication between processes is performed via message passing. Each process has a mailbox where messages from the "outside" world are placed, waiting to be processed. Once that happens, if a response is required, another message will be sent, and another mailbox will get a message!

Getting ready

To get started, go to the code repository where the messages.ex file is located and open a new IEx terminal session. The IEx terminal session will also be an actor in this recipe! We will send messages from it to the process containing the code defined in the module.

How to do it…

Follow these steps to send messages between processes:

  1. Once our session is started, load and compile the messages.ex module:
    iex(1)> ...

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