But first things first. HiveMQ is an MQTT broker written in Java, and as such it will probably run on anything with support for Java. After unpacking the distribution (all paths in here are relative to the directory in which I unpack it) I set the TCP port number for the broker to 1884, so that it wouldn’t collide with the Mosquitto server running on the same machine. Starting the broker is easy enough:
After starting the broker, I published a few messages (using
mosquitto_pub) and subscribed to the broker (using
mosquitto_sub). I stopped the broker, edited the configuration file (
conf/configuration.properties), and enabled Websocket support. In other words, the changes I’ve done so far are:
After restarting the broker, I used HiveMQ’s pretty cool MQTT Websocket Client to connect to
localhost on port 8000. (Yes,
Under no circumstances is this to be considered a benchmark, but I fired off my little boom program, first to a Mosquitto and then to HiveMQ, both running on the same machine (on different TCP ports, of course). The results I got are impressive in both cases (both had a single subscriber listening to the messages):
HiveMQ has support for plugins – bits of code loaded into the broker at start-up. There are already a few plugins we can download and, if you’re a Java programmer you can develop your own plugins. I’m not such a person, so I simply tried installing the Accesslog plugin to see how that works.
The instructions seem easy enough:
- Place the access-log.jar in the plugins folder
Almost. (The second point should be followed by a server restart, which ought to be obvious ;-)
Connections, subscription requests, publishes, etc. are logged into files in the
(The client called
br-tiggr-hivemq is a bridge I configured from Mosquitto to HiveMQ; the latter doesn’t have support for configuring bridges.)
I’m impressed: everything I tried works.
HiveMQ has support for:
- TLS (correctly named in the documentation, but the configuration parameters call it “ssl”)
- X.509 client certificate authentication
- the `$SYS/#’ topic branch (which can be disabled)
- Websockets (as mentioned above) and secure Websockets
- Authentication and authorization via plugins
- Graphite integration
- Connection and bandwidth throttling
Clustering sounds particularly interesting, but I haven’t had a chance to test that yet. I also haven’t set up TLS for the simple reason I really don’t feel like wielding keytool at this time of the day, but I’m very certain that it’ll work as advertised.
HiveMQ is not Open Source, but it’s free to use with a limited amount of simultaneous connections.