Class MqttConnectionFactory

Assembly: redb.Route.MqttNet.dll

Named connection factory for MQTT. Register it in the route registry and reference it by name
from the endpoint URI (connectionFactory=my-broker) so broker credentials never have to
appear in the URI, and therefore can never reach logs, telemetry, or the Tsak dashboard.

Example:
context.AddToRegistry("iot-broker", new MqttConnectionFactory
{
Server = "mqtt.corp.local",
Port = 8883,
UseTls = true,
Username = "svc-ingest",
Password = Environment.GetEnvironmentVariable("MQTT_PASSWORD")
});

// route carries no credentials at all:
r.From("mqtt://sensors/+/temp?connectionFactory=iot-broker")

public sealed class MqttConnectionFactory

Inheritance

Object→MqttConnectionFactory

Properties

Broker

Broker address in host:port form (alternative to ).

public string? Broker { get; set; }

CleanSession

Start a clean session (default true).

public bool CleanSession { get; set; }

ClientId

MQTT client identifier.

public string? ClientId { get; set; }

KeepAlive

Keep-alive interval in seconds (default 60).

public int KeepAlive { get; set; }

Password

Password for broker authentication.

public string? Password { get; set; }

Port

Broker port (1883 plain, 8883 TLS).

public int Port { get; set; }

Server

Broker hostname or IP.

public string? Server { get; set; }

SessionExpiryInterval

MQTT 5 Session Expiry Interval in seconds (default 0: the session ends with the connection).

public int SessionExpiryInterval { get; set; }

Username

Username for broker authentication.

public string? Username { get; set; }

UseTls

Connect over TLS.

public bool UseTls { get; set; }