Question is why some applications (like ejabberd) use own hooks module (e.g. ejabberd_hooks.erl) instead of gen_event?
+3
A:
Don't expect the answer to be too interesting. Either it was because the author wasnt familiar with gen_event, or it didnt perform well enough back in 2004 when ejabberd_hooks was added.
Christian
2009-11-11 18:58:29
I would tend to agree with Christian.
jldupont
2009-11-11 19:07:18
+1, if your question is geared toward which should you use? then go with gen_event until it no longer meets your needs.
Jeremy Wall
2009-11-11 20:25:27
+10
A:
Ejabberd hooks and gen_event are quite different things. Ejabberd hooks are evaluated by the process calling them - gen_event handlers run in one single gen_event process. As Ejabberd needs to run many hooks for most messages, sending each xmpp message to lots of different gen_event processes wouldn't get as high message throughput as the Ejabberd approach does.
archaelus
2009-11-11 22:32:43