Implementing an MQTT broker

18.9k views Asked by At

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.

2

There are 2 answers

1
hardillb On

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

1
frhack On

Consider also a Mqtt broker as vert.x module like this.

For the second question, the answer is yes, shure.

But why reinvent the wheel ?