[ejabberd] Communicate with other modules

Michael Weibel michael.weibel+xmpp at gmail.com
Mon Jan 30 13:23:41 MSK 2012

Hi Steve,

I managed to get it working by registering the shared resource as a
globally registered gen_server.
But I'll take a look on the gen_fsm which I don't know yet (as I'm still
learning erlang).


Am 30.01.2012 um 10:11 schrieb Stefan Strigler:

> I'm not sure whether gen_server is the right choice here. Typically your
scenario is what's called keeping guard of a shared resource (the link to
the DB). You'd naively implement this by spawning a process which waits for
messages of the other modules to fulfill queries on their behalf and
synchronously or asynchronously send back replies to those other "modules"
(which are running processes itself in fact). This whole thing can be
formalized by using the gen_fsm pattern which is the general approach
ejabberd uses for all of its architecture. By using a supervisor for this
FSM you can make sure to keep such a process up and running in case of
failures (which would otherwise be fatal to the overall system).
> Greets, Steve
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20120130/5ac60ae5/attachment.html>

More information about the ejabberd mailing list