grpc v0.5.0-beta.1 GRPC.Server.Supervisor View Source
A simple supervisor to start your servers.
You can add it to your OTP tree as below. But to make the servers start, you have to config grpc
defmodule Your.App do
use Application
def start(_type, _args) do
import Supervisor.Spec
children = [
supervisor(GRPC.Server.Supervisor, [{Your.Endpoint, 50051(, opts)}])
]
opts = [strategy: :one_for_one, name: __MODULE__]
Supervisor.start_link(children, opts)
end
end
# config.exs
config :grpc, start_server: true
or
run [`mix grpc.server`](Mix.Tasks.Grpc.Server.html) on local
View child_spec/3
for opts.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Return a child_spec to start server.
Callback invoked to start the supervisor and during hot code upgrades.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
child_spec(endpoint, port, opts \\ [])
View Sourcechild_spec(atom() | [atom()], integer(), Keyword.t()) :: Supervisor.Spec.spec()
Return a child_spec to start server.
Options
:cred
- a credential created by functions ofGRPC.Credential
, an insecure server will be created without this option
Link to this function
init(arg)
View Sourceinit({module() | [module()], integer()}) :: {:ok, {:supervisor.sup_flags(), [:supervisor.child_spec()]}} | :ignore
init({module() | [module()], integer(), Keyword.t()}) :: {:ok, {:supervisor.sup_flags(), [:supervisor.child_spec()]}} | :ignore
Callback invoked to start the supervisor and during hot code upgrades.
Developers typically invoke Supervisor.init/2
at the end of their
init callback to return the proper supervision flags.
Callback implementation for Supervisor.init/1
.