MeshxRpc.Server.Pool (MeshxRpc v0.1.0) View Source

RPC server workers pool.

Configuration

RPC server pool is configured with opts argument in child_spec/2 function. Configuration options common to both RPC client and server are described in MeshxRpc "Common configuration" section.

Configuration options specific to RPC server opts argument in child_spec/2:

  • :timeout_execute - request function execution timeout, milliseconds. If timeout is exceeded request function is killed and remote RPC client call will error with: {:error_rpc, :killed}. The default value is :infinity.

Link to this section Summary

Functions

Returns a specification to start a RPC server workers pool under a supervisor.

Link to this section Functions

Link to this function

child_spec(id, opts \\ [])

View Source

Specs

child_spec(id :: atom(), opts :: Keyword.t()) :: Supervisor.child_spec()

Returns a specification to start a RPC server workers pool under a supervisor.

id is a pool id which should be a name of a module implementing user RPC functions.

opts are options described in "Configuration" section above and in MeshxRpc "Common configuration" section.

iex(1)> MeshxRpc.Server.Pool.child_spec(Example1.Server, address: {:uds, "/tmp/meshx.sock"})
%{
  id: {:ranch_embedded_sup, Example1.Server},
  start: {:ranch_embedded_sup, :start_link,
   [
     Example1.Server,
     :ranch_tcp,
     %{socket_opts: [ip: {:local, "/tmp/meshx.sock"}, port: 0]},
     MeshxRpc.Server.Pool,
     [
       ...
     ]
   ]},
  type: :supervisor
}