gen_event event handlers and supervisors

Garrett Smith g@REDACTED
Sat Jan 16 01:21:03 CET 2010


It seems that in order to hook gen_event event handlers into an OTP
supervisory tree, one must "wrap" them in a gen_server, adding them
using the add_sup_handler and then handling the EXIT message by
crashing, letting the supervisor handle the crash.

Is the recommended approach for building fault tolerance into
gen_event event handlers?

If this is the case, it strikes me as something one would do 100% of
the time in production settings -- i.e. who would ever tolerate the
silent failure and unregistration of an event handler??

I'm curious how others handle this problem. Do you routinely create a
gen_server to effectively plug the event handler into a supervisory
tree? Or is there another predominating pattern that bypasses
gen_event and accomplishes something similar (i.e. broadcast style
event handling)?

Garrett


More information about the erlang-questions mailing list