How to make use of gen_event behaviour

suresh saragadam sureshsaragadam@REDACTED
Fri Oct 22 13:30:27 CEST 2004

Hello Wiger, 
-> Thus, each event handler can choose to match on every event that comes in
here in this case i only need 'one event handler' 
Ok fine, then i need only one event handler,  and 'N' different functions defined to handle 
'N' different events,  
Thanking you .
suresh saragadam

"Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED> wrote:
Hi Suresh,
You only need one handler and one module, regardless of the number of events.
Gen_event works such that for each incoming event, the function handle_event(Event, State) is called in every installed event handler. Thus, each event handler can choose to match on every event that comes in, or perhaps only on one or a few. It's of course important to have a catch-all clause, so that the handler doesn't crash if a new event is introduced.
The only real point to having several different event handler modules is if you have several different _types_ of event handler. Multiple instances could for example be used if you have an event handler that filters events and sends messages to a worker process; the worker process could then install and supervise its own instance of a generic handler.
-----Original Message-----
From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of suresh saragadam
Sent: den 21 oktober 2004 05:41
To: Erlang
Subject: How to make use of gen_event behaviour

A  small clarification about gen_event behaviour, 
For suppose i have 25 different events to be handled,  
If i am implementing gen_event behaviour, i should have 1 event manager,
and 25 event handlers,
As event handler is implemented as a callback module, 
I should have 25 callback modules. 
When ever an event occurs particular event handler is called as a call back module
am i correct
if i have '100 events' i should have '100 event handlers' implemented as call back modules
i.e '100 moudles' (each one for one event)

Do you Yahoo!? - Register online to vote today
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list