Two months ago I published in
hex
the first version of
Galena
, a Topic producer-consumer library built on top of
GenStage
for
Elixir
. It was initially designed to create some flows of
producers
,
producer-consumers
and
consumers
where the message has to be delivered as soon as possible. Each consumer or producer-consumer can receive messages from several producers and/or producer-consumers. Besides, consumers and producer-consumers can select the messages that want to receive thanks to a topic approach.
This library was thought to be used by an application which will run in a server but, why don't we try to distribute the Galena's producers, producer-consumers, consumers to several machines?
Elixir code runs in the Erlang Virtual Machine or BEAM and therefore it can take advantage of all its distribution features.
Erlang provides the module global which helps us to registry the name of the process globally. It means that we can interact with any globally registered process after connecting the nodes.
Taking into account these ideas we can use Galena as a distributed producer-consumer system:
This library was thought to be used by an application which will run in a server but, why don't we try to distribute the Galena's producers, producer-consumers, consumers to several machines?
Elixir code runs in the Erlang Virtual Machine or BEAM and therefore it can take advantage of all its distribution features.
Erlang provides the module global which helps us to registry the name of the process globally. It means that we can interact with any globally registered process after connecting the nodes.
Taking into account these ideas we can use Galena as a distributed producer-consumer system:
iex(test1@machine1)> MyProducer.start_link([], [name: {:global, :producer}] iex(test2@machine2)> MyConsumer.start_link([producers_info: [{["topic"], {:global, :producer}}]], [name: {:global, :consumer}])