Tortoise311.Supervisor (tortoise311 v0.12.1)
View SourceA dynamic supervisor that can hold Tortoise311.Connection processes
A Tortoise311.Supervisor, registered under the name
Tortoise311.Supervisor, is started as part of the Tortoise311.App,
which will get started automatically when Tortoise311 is included as
a Mix dependency. Spawning a connection on the
Tortoise311.Supervisor can be done as follows:
{:ok, pid} =
Tortoise311.Supervisor.start_child(
client_id: T1000,
handler: {Tortoise311.Handler.Logger, []},
server: {Tortoise311.Transport.Tcp, host: 'localhost', port: 1883},
subscriptions: [{"foo/bar", 0}]
)While this is an easy way to get started one should consider the
supervision strategy of the application using the
Tortoise311.Connections. Often one would like to close the connection
with the application using the connection, in which case one could
consider starting the Tortoise311.Connection directly in the
supervisor of the application using the connection, or start a
Tortoise311.Supervisor as part of ones application if it require more
than one connection.
See the Connection Supervision article in the project documentation for more information on connection supervision.
Summary
Functions
Returns a specification to start this module under a supervisor.
Start a connection as a child of the Tortoise311.Supervisor.
Start a dynamic supervisor that can hold connection processes.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Start a connection as a child of the Tortoise311.Supervisor.
supervisor is the name of the supervisor the child should be
started on, and it defaults to Tortoise311.Supervisor.
Start a dynamic supervisor that can hold connection processes.
The :name option can also be given in order to register a supervisor
name, the supported values are described in the "Name registration"
section in the GenServer module docs.