Path: redb-route/redb.Route.MqttNet/Connection/MqttBrokerRegistry.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.MqttNet/Connection/MqttBrokerRegistry.cs ---- namespace redb.Route.MqttNet.Connection; /// /// Registry for named MQTT broker connections. /// public interface IMqttBrokerRegistry { /// Gets broker options by name. MqttBrokerOptions GetOptions(string name); /// Checks if a named broker is registered. bool Contains(string name); } /// /// In-memory broker registry. Populated at startup via . /// internal sealed class MqttBrokerRegistry : IMqttBrokerRegistry { private readonly Dictionary _brokers = new(StringComparer.OrdinalIgnoreCase); /// Registers a broker with the given name. internal void Register(string name, MqttBrokerOptions options) { ArgumentException.ThrowIfNullOrWhiteSpace(name); ArgumentNullException.ThrowIfNull(options); _brokers[name] = options; } /// public MqttBrokerOptions GetOptions(string name) { if (_brokers.TryGetValue(name, out var options)) return options; throw new InvalidOperationException( $"MQTT broker '{name}' is not registered. Call AddBroker(\"{name}\", ...) in AddRedbRouteMqtt()."); } /// public bool Contains(string name) => _brokers.ContainsKey(name); }