MLLP.Receiver.child_spec
You're seeing just the function
child_spec
, go back to MLLP.Receiver module for more information.
Link to this function
child_spec(init_arg)
Specs
child_spec(options()) :: Supervisor.child_spec()
A function which can be used to embed an MLLP.Receiver under Elixir v1.5+ supervisors.
Unlike start/1
, start/2
, or start/3
this function takes two additional options : ref
and transport_opts
.
Note that if a ref
option is not supplied a reference will be created for you using make_ref/0
.
children = [{MLLP.Receiver, [
ref: MyRef,
port: 4090,
dispatcher: MLLP.EchoDispatcher,
packet_framer: MLLP.DefaultPacketFramer,
transport_opts: %{num_acceptors: 25, max_connections: 20_000}
]}
]
Supervisor.init(children, strategy: :one_for_one)
See Options for details on required and optiomal parameters.
Examples
iex(1)> opts = [ref: MyRef, port: 4090, dispatcher: MLLP.EchoDispatcher, packet_framer: MLLP.DefaultPacketFramer]
[
ref: MyRef,
port: 4090,
dispatcher: MLLP.EchoDispatcher,
packet_framer: MLLP.DefaultPacketFramer
]
iex(2)> MLLP.Receiver.child_spec(opts)
%{
id: {:ranch_listener_sup, MyRef},
start: {:ranch_listener_sup, :start_link,
[
MyRef,
:ranch_tcp,
%{socket_opts: [port: 4090], num_acceptors: 100, max_connections: 20_000},
MLLP.Receiver,
%{
packet_framer_module: MLLP.DefaultPacketFramer,
dispatcher_module: MLLP.EchoDispatcher,
context: %{},
allowed_clients: %{},
verify: nil
}
]},
type: :supervisor,
modules: [:ranch_listener_sup],
restart: :permanent,
shutdown: :infinity
}