[erlang-questions] process hierarchy and passing references

Ladislav Lenart lenartlad@REDACTED
Thu Aug 14 17:00:38 CEST 2014


Hello.

What about the following solution:
* Put all three processes under one supervisor.
* Set its restart strategy to one_for_all.
* Pass supervisor's PID to its children.
* Each worker process can lookup PID of its relevant sibling via
supervisor:which_children/1.

HTH,
Ladislav Lenart


On 14.8.2014 16:48, Schneider wrote:
> Hi list,
> 
> Since I am very new to Erlang, I am not sure how to layout process 
> hierarchies in the following case:
> 
> Besides the domain specific functionality, every program has a RPC 
> middleman and an XML-RPC interface, each implemented as gen_servers. In 
> the current setup, the main gen_server process starts the RPC middleman, 
> passing it its Pid, and the RPC gen_server starts the XML-RPC server 
> which is passed the RPC middleman's Pid.
> Using the passed in Pid's, the XML-RPC server can do a 
> gen_server:call()/cast() back to the RPC server which on its turn can 
> call the main server. Works ok, but I would like to have the RPC 
> middleman and XML-RPC controller under the control of a supervisor. The 
> main supervisor should start the main gen_server process plus a 
> supervisor that on its turn should start the RPC midleman and the 
> XML-RPC handler.
> The thing I can't figure out is how the XML-RPC process should find the 
> RPC middleman process and how that process should locate the main server 
> when using supervision. Since there can be many RPC middlemen and 
> XMP-RPC servers around, each belonging to different main servers, naming 
> and registering seems a little hard.
> So how to pass references around?
> 
> Any help will be very much appreciated.
> 
> Frans
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 





More information about the erlang-questions mailing list