MQTT Bridge
Bridges are a non-standard way, although kind of a de-facto standard among MQTT broker implementations, to connect two different MQTT brokers to eachother. This allows for example that a topic tree of a remote broker becomes part of the topic tree on the local broker. VerneMQ supports plain TCP connections as well as SSL connections.
Enabling the bridge functionality
in VerneMQ the bridge is distributed with VerneMQ as a plugin and is not enabled by default. After configuring the bridge as described below, make sure to enable the plugin by setting:
See Managing plugins for more information on working with plugins.
When the plugin is enabled a simple status interface is available:
Sample MQTT Bridge
Setup a bridge to a remote broker:
Different connection parameters can be set:
Define the topics the bridge should incorporate in its local topic tree (by subscribing to the remote), or the topics it should export to the remote broker (by publishing to the remote). We share a similar configuration syntax to that used by the Mosquitto broker:
topic
defines a topic pattern that is shared between the two brokers. Any topics matching the pattern (which may include wildcards) are shared. The second parameter defines the direction that the messages will be shared in, so it is possible to import messages from a remote broker usingin
, export messages to a remote broker usingout
or share messages inboth
directions. If this parameter is not defined, VerneMQ defaults toout
. The QoS level defines the publish/subscribe QoS level used for this topic and defaults to0
. (Source: mosquitto.conf)
The local-prefix
and remote-prefix
can be used to prefix incoming or outgoing publish messages.
Currently the #
wildcard is treated as a comment from the configuration parser, please use *
instead.
A simple example:
Sample MQTT Bridge that uses SSL/TLS
SSL bridges support the same configuration parameters as TCP bridges, but need further instructions for handling the SSL specifics:
Last updated