[erlang-questions] pub-sub server implementation detail question.

Huseyin Yilmaz yilmazhuseyin@REDACTED
Wed Mar 6 10:53:46 CET 2013

It seems to me like gen_event is implemented as message proxy. We send a
new event, and gen_event calls all the handlers. Handlers sends multiplies
messages to actual receivers. So what gen_event actually does is to
multiply messages in another process context so actual event generator
process does not spend time with generating messages.

According to this perspective. gen_event code should be as little as
possible (no calculation, only message sending code.).
Does that sound about right?

On Tue, Mar 5, 2013 at 10:55 PM, Dmitry Kolesnikov

> Yep, this is another headache…
> You have to write a gen_server that acts as "supervisor" for that
> event_handler...
> - Dmitry
> On Mar 5, 2013, at 10:37 PM, Tim Watson <watson.timothy@REDACTED> wrote:
> > On 5 Mar 2013, at 20:26, Dmitry Kolesnikov wrote:
> >> If you implement PubSub via gen_event then all you subscriber handlers
> are executed within dispatcher process. This is not good. you would end-up
> implementing an gen_event handler as a proxy to your subscriber. Why to
> bother if ten_server can be used directly.
> >
> > Not to mention the fact that if a gen_event handler crashes, it is
> silently and unceremoniously removed. See add_sup_handler for a way around
> that old chestnut. :)
> >
> > Cheers,
> > Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130306/f7c579b1/attachment.htm>

More information about the erlang-questions mailing list