[erlang-questions] Sending messages to gen_event manager
Ben Hood
0x6e6562@REDACTED
Sat Jul 21 17:59:56 CEST 2007
Thanks for clarifying point 1 so concisely.
> > 2. Say I have multiple event handlers that need to respond differently
> > to different types of events, it is a sounder design to add multiple
> > callbacks to one event manager and then pattern match on the
> > handle_event/2 callback, or does it make more sense to just create a
> > new event manager for each event type?
> >
> > Naively I would go for the latter option, but this may create lots of
> > event manager processes. Is this problematic?
>
> This is pretty much a design decision depending on the types of
> events, and what you do with them. Either approach will work fine,
> it's just a matter of figuring out which is simplest in your case.
>
> Be aware that all event handlers run in series in the process of the
> event manager. An event handler which crashes is silently deleted
> from the event manager - use add_sup_handler to get notifications of
> this.
So the implication of the serial execution is that if you wanted
different events to be handled by different handlers concurrently, you
would have to use separate manager processes, right?
Thx,
Ben
More information about the erlang-questions
mailing list