off_broadway_mqtt v0.2.0 OffBroadway.MQTT.Client View Source
Implemens the default MQTT client that is used by the producer to connect to the broker.
The client
- establishes the connection to OffBroadway.MQTT broker
- subscribes to the provided topic
- wrapping the received payload in a
OffBroadway.MQTT.Data.t/0struct. - enques received and wrapped messages to the passed queue
This module relies on Tortoise and Tortoise.Supervisor.start_child/1
establish the connection and subscribe to the topic.
Link to this section Summary
Functions
Starts a MQTT client for the passed subscription with a random client id.
Link to this section Types
Link to this type
option()
View Source
option()
View Source
option() ::
{:sub_ack, nil | Process.dest()} | {:client_id, String.t()} | {atom(), any()}
option() ::
{:sub_ack, nil | Process.dest()} | {:client_id, String.t()} | {atom(), any()}
Type for options for start/4.
:client_id- Can be used to set the client id for the connection. If not given a random client id is generated.sub_ack- AProcess.dest/0that receives a message as soon as the subscription is acknowledged. The subscriber receives a message in the form{:subscription, client_id, topic, status}.
Link to this type
options()
View Source
options()
View Source
options() :: [option()]
options() :: [option()]
Collection type for all options that can be passed to start/4
Link to this section Functions
Link to this function
start(config, arg, queue_name, opts \\ []) View Source
Starts a MQTT client for the passed subscription with a random client id.
Options
:client_id- Can be used to set the client id for the connection. If not given a random client id is generated.sub_ack- AProcess.dest/0that receives a message as soon as the subscription is acknowledged. The subscriber receives a message in the form{:subscription, client_id, topic, status}.