One of the great things about working with Elixir is the ease with which you can implement a solution to a problem using just Elixir/Erlang and not relying on an eternal system. PubSub is a great example of this. Phoenix has a Pubsub implementation that currently supports both Redis or PG2 as adapters. PG2 is an erlang library for distributed named process groups, which allows messages to be sent to a named group of processes. In our case it becomes the method for setting up subscriptions that work across nodes.
In the following video we’ll add a PubSub worker to our supervision tree, create a subscriber, and show how it works in a distributed manner across nodes.
Get notified of any new episodes as we release them.