The Mqtt broker#

Configuration#

Within the MqttBroker section of the manifest file you can configure how to connect to mqtt brokers. At the moment mqtt2otel does not provide a broker itself so an external one has to be used.

A simple example for a mqtt broker connection would look like that:

1MqttBroker:
2  - Name: "My broker"
3    Endpoint:
4      Port: 1813
5      Protocol: tcp
6      Address: "mymqtt-broker.net"
7      EnableTls: false

It has the following parameters:

ParameterDescription
NameAn optional name that can be given to the broker. With this the broker can be refered to later.
DescriptionAn optional description of the broker
Eendpoint.ProtocolThe optional protocol that will be used for connecting to the broker, e.g. tcp.
Endpoint.AddressThe address of the mqtt broker
Endpoint.PortThe optional port under which the broker can be reached. Default is 1813.
Endpoint.ConnectionTypeOne of the following values: Tcp, WebSockets. Default is tcp.
Endpoint.MqttProtocollVersionOptional. You can set an explicit mqtt protocol version in case of compatibility issues.
Endpoint.EnableTlsSet to false to disable transport level security (TLS). Default is true.
Endpoint.TlsSslProtocolOptional. Choose the ssl protocol: Tls, Tls11, Tls12, Tls13, Ssl2, Ssl3, Default
Endpoint.TlsCaFilePathOptional. Set a file path for a certificate authority (CA) file.
Endpoint.UsePacketFragmentationSet to false to disable packet fragmentation (may be needed to connect to AWS broker.
Endpoint.UsernameThe credentials username for basic authentication.
Endpoint.PasswordThe credentials password for basic authentication.
ReconnectDelayInMsSets the delay intervall on reconnect in milliseconds. Default: 5000
ClientPrefixA prefix that will be added to the client id when connecting to the broker. Helps to identify the client.

Using multiple connections#

The MqttBroker section contains a list of brokers. That means you can add multiple brokers. The first broker in this list is always the default broker, that will be used if nothing else is specified. If you want to address another broker, than the default you have to use the provided name of the broker.