OTP Application

Applications are the way you package related modules in Erlang. The focus here isn’t on packaging for distribution but on being able to treat a bunch of modules as a single entity. Although OTP applications can be merely some library code for others to call, more often they're like creatures with a life of their own: they start up, do what they’re designed to do, and shut down. Some can have multiple running instances, and some are limited to one instance at a time. (Logan, Merritt, and Carlsson 2010, 119)

Releases and Targets

OTP applications provide convenient units of functionality, but only on the Erlang programming level. To build a complete standalone software service - something that runs on one or more machines on your network and communicates with your other systems and with your users - you must typically combine a number of such applications that will run on a single Erlang runtime system. In OTP, such a higher-level package is called a release, and the result of installing a release on some host machine is called a target system. (Logan, Merritt, and Carlsson 2010, 242)

Packaging an Application

  • Active Applications have a life cycle and must be started in order to be useful.
  • Library Applications are a passive collection of modules to be used by other applications, and they don’t need to be started or stopped.
{application, example,
  [{description, "Description Example"},
   {vsn, "0.0.1"},
   {modules, [example, example_sup,example_app]},
   {registered,[example, example_sup]},
   {applications, [kernel,stdlib]},
   {mod, {example_app,[]} }]}.

References:

Logan, Martin, Eric Merritt, and Richard Carlsson. 2010. Erlang and Otp in Action. Manning Publications Co.

Backlinks: