I’m writing my first distributed erlang application, and I notice that I have to know the node on which I have my “service” up. How can I send requests to my service without knowing on which node it is running?
Basically I want to do something like this:
ReferenceToTheServiceProcess = locate(my_service).
ReferenceToTheServiceProcess ! {request, Stuff}.
Or something else to the equivalent effect (loose coupling).
Thanks!
You could register your service process with a global name, for example using
gproc. That way you don’t have to know which node your service currently resides on, and your could would pretty much look like you wanted.