SV: [erlang-questions] Re: Interfaces between distributed OTP applications

Ulf Wiger <>
Fri Jan 29 23:22:13 CET 2010


(1) is the proper way to do it, but it also requires that 'server' is able to find its own processes. One way to do this is to register them globally.

A possibility is also to have the API assume that the caller is local, and for 'client' to use rpc:call(...). In some cases, it actually makes sense to have the client explicitly choose the server node.

...and you should definitely add the dependency in the .app file.

BR,
Ulf W (in transit, waiting for a train that is more than 1hr delayed, due to the cold)

-- originalmedd. --
Ämne: [erlang-questions] Re: Interfaces between distributed OTP applications
Från: ZZZZZZZZZZZZZZZZ <>
Datum: 2010.01.29 17.31

I hate to repost, but maybe somebody can answer?
thanks in advance
Zvi

On Jan 26, 10:36 am, ZZZZZZZZZZZZZZZZ <> wrote:
> 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
>
> ________________________________________________________________
> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list