Envío is a set of handy tools to simplify dealing with Elixir Registry. It includes the instance of Registry to be used out of the box, as well as scaffolds to ease producing of publishers and subscribers.
Scaffolding the subscriber:
defmodule MySubscriber do
use Envio.Subscriber, channels: [{MyPublisher, :main}]
def handle_envio(message, state) do
{:noreply, state} = super(message, state)
IO.inspect({message, state}, label: "Received")
{:noreply, state}
end
end