MeshxRpc.Server behaviour (MeshxRpc v0.1.0) View Source
Convenience module on top of MeshxRpc.Server.Pool
.
Module leverages Kernel.use/2
macro to simplify user interaction with MeshxRpc.Server.Pool
module:
- current module name is used as pool id,
- pool options can be specified with
use/2
clause.
Please refer to MeshxRpc.Server.Pool
documentation for details.
Example RPC server module:
# lib/server.ex
defmodule Example1.Server do
use MeshxRpc.Server,
address: {:tcp, {127, 0, 0, 1}, 12_345},
telemetry_prefix: [:example1, __MODULE__],
timeout_execute: 15_000
def echo(args), do: call(:echo, args)
def raise_test(args), do: raise(args)
end
Start with application supervisor:
# lib/example1/application.ex
def start(_type, _args) do
Supervisor.start_link([Example1.Server],
strategy: :one_for_one,
name: Example1.Supervisor
)
end
Link to this section Summary
Callbacks
Returns a specification to start a RPC server workers pool under a supervisor.
Link to this section Callbacks
Specs
child_spec(opts :: Keyword.t()) :: Supervisor.child_spec()
Returns a specification to start a RPC server workers pool under a supervisor.