tortoise v0.9.4 Tortoise.Supervisor View Source
A dynamic supervisor that can hold Tortoise.Connection processes
A Tortoise.Supervisor, registered under the name
Tortoise.Supervisor, is started as part of the Tortoise.App,
which will get started automatically when Tortoise is included as
a Mix dependency. Spawning a connection on the
Tortoise.Supervisor can be done as follows:
{:ok, pid} =
Tortoise.Supervisor.start_child(
client_id: T1000,
handler: {Tortoise.Handler.Logger, []},
server: {Tortoise.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
Tortoise.Connections. Often one would like to close the connection
with the application using the connection, in which case one could
consider starting the Tortoise.Connection directly in the
supervisor of the application using the connection, or start a
Tortoise.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.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Start a connection as a child of the Tortoise.Supervisor
Start a dynamic supervisor that can hold connection processes
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Start a connection as a child of the Tortoise.Supervisor.
supervisor is the name of the supervisor the child should be
started on, and it defaults to Tortoise.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.