Bridge two MQTT Brokers to pass topic messages between them. Acts as a client on both brokers rather than broker-broker bridge ala Mosquitto.
The idea is to bridge between physical-physical brokers or physical-cloud brokers.
Bridge can be one-way (primary > secondary) or two-way with sync between brokers.
Topics can be filtered for each broker for messages bridged.
-
Run the app by entering the following command in the command shell:
dotnet run -- --config=config.json
-
CLI - Can configure cli via config file in yaml/json. Or by passing values directly
MqttBridge.exe --config=config.json
MqttBridge.exe --primary=localhost:1883 --secondary=localhost:1884
-
Library - Bridge can be configured with primary & secondary brokers.
var primaryOptions = new MqttClientOptionsBuilder() .WithClientId("Primary") .WithTcpServer("localhost", 1883) .WithCleanSession(); var bridgeOptions = new BridgeOptions { PrimaryOptions = primaryOptions.Build(), SecondaryOptions = secondaryOptions.Build(), PrimaryFilters = new TopicFilter[] {new TopicFilterBuilder().WithTopic("primary/topic").Build()} SecondaryFilters = new TopicFilter[] {new TopicFilterBuilder().WithTopic("secondary/topic").Build()} SyncMode = true }; var bridge = new Bridge(bridgeOptions); await bridge.ConnectAsync(CancellationToken.None);
Install the following:
MqttBridgeCli.exe from releases
Nuget MqttBridge from packages
xUnit testing
dotnet test
Testing templates being used
dotnet test
Editor.config
Editor.config
dotnet publish
- MqttNet - MqttNet
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Scott Mackenzie - Initial work - Smacktech
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
- mmm