MQTT共享订阅以解决分布式系统中的重复问题
我们构建服务器以从另一台MQTT服务器订阅主题。当我们只有一台服务器时,它可以很好地工作。但是,当我们将其扩展到多个服务器时,它就出错了。由于每个服务器都会从订阅中收到相同的消息,因此所有服务器都会多次执行。
mqtt v5 问题:
- mqtt.js 支持此功能吗?我在文档中找不到它。
- 如果我们仍在使用MQTT v3.1.1,请使用任何替代解决方案来解决此问题?
We build the server to subscribe the topics from another MQTT server. It works perfectly when we have only one server. However, when we scale it to multiple servers it went wrong. Because each of servers receive the same message from the subscription, everything performs multiple times.
MQTT v5 solves this problem, but I have the 2 questions:
- Is the MQTT.js supports this feature? I cannot find it in the documentation.
- If we are still using MQTT v3.1.1, any alternative solution to solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于共享订阅的工作方式,也没有任何MQTT v5.0具体的(新标头空间中的没有),因此没有理由为什么它不应适用于连接到v3.1.1/v5.0的v3.1.1客户端。提供共享订阅功能的兼容经纪人。
我不记得哪个经纪人在v3.1.1上支持它,因此您必须检查所使用的经纪人。
There is also nothing MQTT v5.0 specific about how Shared Subscriptions work, (nothing in the new header space) so there is no reason why it shouldn't work for a v3.1.1 client connecting to a v3.1.1/v5.0 compatible broker that offers the Shared Subscription feature.
I can't remember which brokers supported it at v3.1.1 so you will have to check which broker you are using.