[erlang-questions] register existing process as event handler

Robert Virding <>
Wed Sep 7 11:12:35 CEST 2011


Event managers/handlers are different to gen servers/fsms. With a server/fsm each one is a separate process with one callback module which is either a gen_server or a gen_fsm behaviour.

With event managers/handlers only the event manager is a separate process. Event handlers are just callback modules which you register with event managers. You can register many event handlers with each manager and register a handler with many managers. When an event manager receives an event it calls a callback function in each event handler module which has been registered with it. The callback functions are evaluated directly in the event manager process, so event handlers as such are not separate processes.

Of course an event handler module can send messages for the events it processes, this is the common case, but such processes are not really the actual event handlers.

Robert

----- Original Message -----
> Hello
> 
> I have one beginner-question regarding gen_event:
> 
> Is it possible to register an existing process as an event handler to
> an event manager (or to multiple event managers)?
> 
> Thanks
> 
> Best,
> 
> Zsolt
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list