It's a plugin created for Gmqtt broker, to make it act like a mqtt proxy, with messages buffering support when the destination broker is down.
-
Clone Gmqtt project
-
Edit
plugin_imports.yml
file in the root directory and add proxy plugin:
packages:
- admin
- prometheus
- federation
- auth
# add proxy plugin in the end of the list
- proxy
- Edit
cmd/gmqttd/default_config.yml
file and add proxy plugin:
plugin_order:
- prometheus
- admin
- federation
# add proxy plugin here
- proxy
- Go to
plugin
directory and clone this project:
git clone https://github.com/Oliveirakun/gmqtt-proxy-plugin.git
- Rename the directory:
mv gmqtt-proxy-plugin proxy
- Go back to root directory and install the plugin dependencies:
go get github.com/eclipse/paho.mqtt.golang
- Export an environment variable with the destination broker uri:
export REMOTE_MQTT_BROKER=tcp://127.0.0.1:1884
- Run the project:
make run
Route | Description |
---|---|
/v1/toogle?stop=true | Stop sending messages to destination broker |
/v1/toogle?stop=false | Restart sending messages to destination broker |
/v1/toogle?stop=false&broker-uri=tcp://127.0.0.1 | Restart sending messages to a different broker |
Licensed under MIT, see LICENSE