Search code examples
erlangelixirerlang-otpgen-server

Can I call GenServer client functions from a remote node?


I have a GenServer on a remote node with both implementation and client functions in the module. Can I use the GenServer client functions remotely somehow?

Using GenServer.call({RemoteProcessName, :"app@remoteNode"}, :get) works a I expect it to, but is cumbersome.

If I want clean this up am I right in thinking that I'd have to write the client functions on the calling (client) node?


Solution

  • You can use the :rpc.call/{4,5} functions.

    :rpc.call(:"app@remoteNode", MyModule, :some_func, [arg1, arg2])