Astarte.Flow.Blocks.MqttSink (astarte_flow v0.1.0)
An Astarte Flow consumer that publishes MQTT messages from incoming Flow messages.
This block supports only incoming messages with type :binary
, so
serialization to binary format must be handled in a separate block before the
message arrives here.
When a message is received, MqttSink
generates an MQTT publish with this conversion process:
key
is used as topicdata
is used as payloadtype
must always be:binary
, messages without a binary type are discarded
Link to this section Summary
Functions
Starts the MqttSource
.
Link to this section Functions
Link to this function
start_link(opts)
@spec start_link(opts) :: GenServer.on_start() when opts: [opt], opt: {:broker_url, String.t()} | {:client_id, String.t()} | {:username, String.t()} | {:password, String.t()} | {:ignore_ssl_errors, boolean()} | {:qos, Tortoise.qos()}
Starts the MqttSource
.
options
Options
broker_url
(required): the URL of the broker the source will connect to. The transport will be deduced by the URL: ifmqtts://
is used, SSL transport will be used, ifmqtt://
is used, TCP transport will be used.client_id
: the client id used to connect. Defaults to a random string.username
: username used to authenticate to the broker.password
: password used to authenticate to the broker.ca_cert_pem
: a PEM encoded CA certificate. If not provided, the default CA trust store provided by:certifi
will be used.client_cert_pem
: a PEM encoded client certificate, used for mutual SSL authentication. If this is provided, alsoprivate_key_pem
must be provided.private_key_pem
: a PEM encoded private key, used for mutual SSL authentication. If this is provided, alsoclient_cert_pem
must be provided.ignore_ssl_errors
: if true, accept invalid certificates (e.g. self-signed) when using SSL.qos
: the qos that will be used to publish messages. Defaults to 0.