[erlang-questions] beginner architectural question

Maxim Sokhatsky <>
Tue Nov 11 12:02:43 CET 2014


Hello!

Here is best practice for PubSub. In init of your collector you register process pid with symbolic name. In Erlang applications the underlying implementation usually relies on ETS. You may think of it as an variable in ETS table.

     collector:init([]) -> pubsub:reg(“collector”,self()).

In calculators you should not use an unique pid, but a given symbolic name of the only subscriber in your system, the “collector”.

     calculator:reduce(Data) -> pubsub:send(“collector”,Data).

This fits the GPROC pubsub and RABBITMQ.

-- 
Maxim




More information about the erlang-questions mailing list