[erlang-questions] Decoupling supervisor:start_child from a web front end

Andy Richards <>
Wed May 9 10:58:09 CEST 2012


Hi all,

What the most appropriate way of calling supervisor:start_child on a remote node when the supervisor module does not exist locally?

I have a scenario where I have a webmachine web front end which needs to spawn a child process via a supervisor on a backend middleware node. My supervisor exists on my target middleware node so I could call from my web tier either...

supervisor:start_child({Name, Node}, [list_of_terms]) 

...however this duplicates the code in my own target supervisor module start_child function and feels as though I'm coupling my middleware to my front end should my supervisor start_ child function ever change? or I could call...

rpc:call(Node, Module, Function, [Args]) 

...but this feels a bit clunky and I'm unsure if there is additional overhead with rpc:call compared to the above approach?

What's the best approach ?

Many thanks,

Andy.


More information about the erlang-questions mailing list