Included applications

Max E. Kuznecov <>
Mon Jan 11 23:46:26 CET 2010


Hello!

I've got a question about included_application option in app file.
What I want is to start my system by running single top-level
supervisor and let it start all other required applications under its
supervision tree.
manpage for app(4) says:

included_applications:
             All applications which are included by this application.
When  this  application  is  started,  all
             included  application will automatically be loaded, but
not started, by the application controller.
             It is assumed that the topmost supervisor of the included
application is started by a supervisor of
             this application.

I cannot get it how should I actually start those included applications.

If I write in toplevel.app:

{included_applications, [worker1, worker2]},

And in toplevel_sup.erl:

{ok, Included} = application:get_key(included_applications),

lists:foreach(fun(App) ->  application:start(App) end, Included),

I end up with both worker1 and worker2  indeed started. But appmon
shows they're both in the same level as my toplevel, i.e. they're not
in topelevel's supervision tree (or appmon just doesn't show that
relation?)

If I instead replace application:start() with App:start_link(), I get
supervision tree I was expecting for (both workers under toplevel's
tree), but calling application:which_applications() shows only
toplevel as being loaded and started.
I'm quite confused about all this. Could anyone please explain what is
the proper way of achieving my goal here?

Thanks.

-- 
~syhpoon


More information about the erlang-questions mailing list