本文介绍了消息顺序是否保留在MQTT消息中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道消息发送顺序是否被保留.也就是说,当发布者发送一系列消息时,是否每个订阅者都能保证收到与发布者发送的消息相同的序列?对于干净会话和持久会话?
I wonder if the message sent order is preserved. That is, when a publisher sends a sequence of messages, is each subscriber guaranteed to receive the same sequence as the publisher had sent it? For both clean and persistent sessions?
推荐答案在规范本身中可以找到MQTT 3.1.1中消息排序功能的摘要此处.
A summary of the message ordering capabilities in MQTT 3.1.1 can be found in the specification itself here.
总结:
- 不能保证使用不同QoS值发布的消息的相对顺序. (例如,QoS 0可以取代QoS 2,因为它涉及单个数据包,而不是后者的4个数据包.)
- QoS 0消息将按顺序传递(尽管消息可能会丢失)
- QoS 2消息将按顺序传递
- QoS 1允许消息重复-重复消息可能在发布的下一条消息的第一个实例之后到达.
- no guarantees are made about the relative ordering of messages published with different QoS values. (for example, QoS 0 can over take QoS 2 for example as it involves a single packet rather than the 4 packets of the latter).
- QoS 0 messages will be delivered in order (albeit messages may get lost)
- QoS 2 messages will be delivered in order
- QoS 1 allows for message duplicates - it is possible a duplicate will arrive after the first instance of the next message that was published.
如果客户端/经纪人在任何时间仅允许单个消息飞行,则可以保证QoS 1排序.
QoS 1 ordering can be guaranteed if the client/broker only allow a single message inflight at any time.
更多推荐
消息顺序是否保留在MQTT消息中?
发布评论