java 实现 MQTT 代理
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30809894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Implementing an MQTT broker
提问by RagHaven
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.
我正在尝试在 Google Compute Engine 之上实现一个 Java MQTT 代理。我的代理将用于处理来自 IoT 设备的大量订阅和发布消息。因此,我计划使用自动缩放功能来满足我的负载需求。
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.
我不确定应该使用哪个基于开源 Java 的 MQTT 代理来开始我的实现。我希望我能得到一些建议。我特别在寻找支持持久订阅者、保留消息、通配符等功能的开源代理。
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.
另外,由于 MQTT 是基于 TCP 构建的,我可以从头开始构建自己的代理,它使用 Java 套接字并侦听端口吗?我假设答案是否定的,但我想澄清一下。
回答by hardillb
There is a list of broker implementations available here:
这里有一个可用的代理实现列表:
https://github.com/mqtt/mqtt.github.io/wiki/servers
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:
它应该是最新的,但可能不包括绝对所有的实现。一些基于 Java 的代理包括:
- HiveMQ
- Moquette
- ActiveMQ
- 蜂巢式MQ
- 毛盖特
- 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
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html