Interfaces between distributed OTP applications

ZZZZZZZZZZZZZZZZ <>
Tue Jan 26 09:36:53 CET 2010


Hi,

the OTP Design Principles states, that OTP Applications are set of
loosely-coupled components, while modules inside single application
are tightly coupled.
Let's say I have two distributed OTP applications:  "client" and
"server", both running on different Erlang nodes/hosts.
Let's say "server" application uses gen_server, which exposes public
function API.
The "client" applications calling functions in public API of
gen_server in "server" application.
What's the proper way to express this in OTP?

1. For simplicity, just add dependency on "server" application in
"client" application's .app file. Start both on "server" node.

2. Don't use public API functions in "server". Send messages directly
to "server" using gen_server:call / cast.

3. Add third application: "server_api" or "server_if" with single
module defining public API wrappers around gen_server messages
protocol. Then "client" application will be depended on "server_api"
application, and not the "server" itself.

4. Any other ideas?

thanks in advance,
Zvi


More information about the erlang-questions mailing list