Skip to content

Instantly share code, notes, and snippets.

@ten0s
Created May 6, 2016 09:38
Show Gist options
  • Save ten0s/0b5458b50ba6c9655e6af827c8b8af30 to your computer and use it in GitHub Desktop.
Save ten0s/0b5458b50ba6c9655e6af827c8b8af30 to your computer and use it in GitHub Desktop.
Distributed publish using gproc w/o gen_leader
Re: [erlang-questions] gproc and gen_event
Of course, for a distributed pub/sub, you don't really need to turn on
the distributed parts of gproc. Running a local gproc instance on each
node, you can publish like so:
publish(Event, Data) ->
rpc:eval_everywhere(
gproc, send,
[{p, l, {?MODULE, Event}}, {?MODULE, Event, Data}]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment