Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule App1.Calculator do
- use GenServer
- def add( num1, num2 ), do: GenServer.call( App1.Caclculator, {:add, num1, num2})
- def handle_call({:add, num1, num2}, _from, state) do
- {:reply, {:ok, num1+num2}, state}
- end
- end
- defmodule App1.Calculator do
- use GenServer
- def handle_call({:add, num1, num2}, _from, state) do
- {:reply, {:ok, num1+num2}, state}
- end
- end
- defmodule Service.Calculator do
- def add(num1, num2), do: GenServer.call(process_name, {:add, num1, num2})
- # Just an example of how you might have named your node and calculator process
- def process_name, do: {:calculator, :"app1@127.0.0.1"}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement