In order to demonstrate it I have decided to develop a proof of concept (PoC) of a Publisher-Subscriber system only using Elixir.
Elixir provides a module called Agent which is prepared for this kind of issues. I will create a SubscriptionManager based on Agent in order to track all the subscriptions.
I will run three BEAMs, one for the publisher and two for the subscribers.
Using whatever IEX (node1, node2 or node3) type the following:
You can find the code in my github.