Skip to content

Instantly share code, notes, and snippets.

@reset
Created June 10, 2014 22:51
Show Gist options
  • Save reset/54024097da2c190d7e88 to your computer and use it in GitHub Desktop.
Save reset/54024097da2c190d7e88 to your computer and use it in GitHub Desktop.
Dependencies in OTP releases

I have an umbrella application which contains a router and a number of different services. Currently everything is deployed as a single OTP release and on a single machine. Now I'm splitting everything apart to live on separate nodes.

A few of these services depend on each other for 1) testing purposes, 2) "public helper" functions are exposed for how to send messages to an erlang process. This works well when you want all of the services started on the same node, but what if you don't want to start the dependant application? Just listing the module in the .app file will ensure that it is started.

Do people typically not depend on an application just to have access to those "public helper" functions? Here is an example to try and explain what I mean:

%
% Public API
%

helper_function(Pid) ->
  gen_server:call(Pid, secret_message).

%
% GenServer callbacks
%

handle_call(secret_message, _, State) ->
  {ok, [], State}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment