Implementing an MQTT broker

RagHaven picture RagHaven · Jun 12, 2015 · Viewed 15.5k times · Source

I am trying to implement a Java MQTT broker on top of Google Compute Engine. My broker will be used to handle a very large number of SUBSCRIBE and PUBLISH messages from IoT devices. So, I am planning on using the autoscaling feature to accommodate my load needs.

I am not sure which Open Source Java based MQTT broker I should use to start off my implementation. I was hoping I could get some suggestions. I am specifically looking for an open source broker that supports features such as durable subscribers, retain message, wildcards etc.

Also, since MQTT is built on TCP, could I just build my own broker from scratch that uses Java sockets and listens on a port? I am assuming the answer for this is no, but I would like to get it clarified.

Answer

hardillb picture hardillb · Jun 12, 2015

There is a list of broker implementations available here:

https://github.com/mqtt/mqtt.github.io/wiki/servers

It should be pretty up to date, but may not include absolutely all implementations. Some of the Java based brokers include:

  • HiveMQ
  • Moquette
  • ActiveMQ

They are not all opensource but there are several

There should be no reason why you couldn't implement your own broker, the protocol spec is here:

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html