How to configure processes, (and applications)

Vance Shipley <>
Mon Feb 21 17:47:11 CET 2005


Anders,

Argument passing is the Erlang way of doing things.  So looking
up application variables in the supervisor and passing them as
arguments to the start functions of workers is better.  What I 
tend to do though is look them up in the application callback
module and pass them to the top level supervisor.  When you have
multiple instances of the same tree this saves more work.

The thing to consider of course is when they will change.  The
application callback module can export config_change/3 which will
be called after a code replacement if there are any changes to
the configuration parameters.

You also might want to change configurations parameters in runtime
yourself with application:set_env/3.  If you do so you will then
need to propagate the change to the running processes somehow.
If you had left the workers to look them up each time you wouldn't
have to.

	-Vance


On Mon, Feb 21, 2005 at 10:11:29AM -0600, Anders Nygren wrote:
}
}  I am pondering the question of how to best get configuration data 
}  to processes and/or applications in an OTP based system.



More information about the erlang-questions mailing list