Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang: Hooks vs gen_event

Tags:

erlang

Question is why some applications (like ejabberd) use own hooks module (e.g. ejabberd_hooks.erl) instead of gen_event?

like image 947
Kirill Trofimov Avatar asked Dec 10 '22 18:12

Kirill Trofimov


1 Answers

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.

like image 164
archaelus Avatar answered Dec 17 '22 21:12

archaelus