apisix/doc/plugins/mqtt-proxy.md
YuanSheng Wang c080f6cc66
doc: added new example to stream-proxy. (#520)
* doc: added new example to `stream-proxy`.
* doc: new doc about `mqtt-proxy`.
2019-09-16 13:03:26 +08:00

1.5 KiB

Summary

Name

The plugin mqtt-proxy only works in stream model, it help you to dynamic load balance by client_id of MQTT.

And this plugin both support MQTT 3.1.* and 5.0.

Attributes

name option description
protocol_name require Name of protocol, shoulds be MQTT in normal.
protocol_level require Level of protocol, it should be 4 for MQTT 3.1.*. it should be 5 for MQTT 5.0.
upstream.ip require IP address of upstream, will forward current request to.
upstream.port require Port of upstream, will forward current request to.

How To Enable

Creates a stream route, and enable plugin mqtt-proxy.

curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -X PUT -d '
{
    "remote_addr": "127.0.0.1",
    "plugins": {
        "mqtt-proxy": {
            "protocol_name": "MQTT",
            "protocol_level": 4,
            "upstream": {
                "ip": "127.0.0.1",
                "port": 1980
            }
        }
    }
}'

Delete Plugin

$ curl http://127.0.0.1:2379/v2/keys/apisix/stream_routes/1 -X DELETE

The mqtt-proxy plugin has been deleted now.