[erlang-questions] Recommended Application Structure
Motiejus Jakštys
desired.mta@REDACTED
Sun Oct 23 20:22:20 CEST 2011
On Sun, Oct 23, 2011 at 01:59:33PM -0400, Matthew Evans wrote:
>
> Let's suppose you have a complex service to deploy (that does related,
> but functionally separate tasks)
> 2) A single app with multiple (hierarchical) supervisors (i.e. 1 .app
> file, all beam files in the same ebin directory):
>
>
> app_foobar
> |
> foobar_sup
> |
> ---------------
> | |
> foo_sup bar_sup
> | |
> foo's bar's
> gen_servers gen_servers
>
>
> Seems like the preference is towards example 2; but to me this means
> that you can't easily decompose and separate functionality apart. It
> also means that messaging can jump across supervisors making for
> somewhat messy interfaces (plus having to cross supervise/link
> gen_servers that are separated by different supervisors).
There is nothing ill with this approach. It depends what you call an
„application“ in your project and how you want to separate its parts.
For instance, my *gateway application* does the whole remote-world
chatting. It has the following components:
* gateway_app for managing the whole gateway (incl. master supervisor)
* Message dispatcher (lots of dynamic supervisors)
* Message receiver:
SOAP (mochiweb with its whole hierarchy)
To be added: XMPP with its whole hierarchy.
Motiejus
More information about the erlang-questions
mailing list