[erlang-questions] Application naming question

Matthew Evans mattevans123@REDACTED
Mon Sep 24 17:54:30 CEST 2012


Hi,
I have an application (let's call it dev_mon) that is responsible for listening to, processing and emitting events on a hardware interface. This application contains 3 supervisors and many registered gen_server processes. Currently we have a single interface that requires supervision.
Future hardware revisions will expose multiple interfaces that requires dev_mon to monitor. Obviously I can handle this in the code, however I believe a better solution would be to have multiple instances of dev_mon for each interface.
In this case I would have application dev_mon_if1, dev_mon_if2, dev_mon_if3 etc. 
The only way I can think of to implement this is to write 3 separate application files (in their own directories) along with their associated Erlang app files. For example:
dev_mon_if1/ebin/dev_mon_if1.erldev_mon_if1/ebin/dev_mon_if1.app
dev_mon_if2/ebin/dev_mon_if2.erldev_mon_if2/ebin/dev_mon_if2.app
dev_mon_if/ebin/..all the other beam files shared between all instances..
The ".app" file would contain an env property that ensures the registered supervisors and gen_servers are unique (e.g. if1, if2 etc).
i.e. not do:








start_link() ->
    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
Instead to:
start_link(RegName) ->    gen_server:start_link({local, RegName}, ?MODULE, [], []).
Where RegName is an atom like 'if1_monitorapp'.
Question: Is there a better way to do this?
Thanks
Matt
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120924/faa46df9/attachment.htm>


More information about the erlang-questions mailing list