简化情况下可以保证mqtt msg传递顺序吗?
can mqtt msg delivery order be guaranteed in simplified case?
如果只有一个代理、一个发布者、一个主题和干净的会话,在这种简化的情况下,
能否保证订阅者端的消息传递顺序与发布者端的发送顺序相同?会不会受到QoS的影响?
第 4.6 from the MQTT 3.1.1 spec 部分涵盖消息排序:
4.6 Message ordering
A Client MUST follow these rules when implementing the protocol flows
defined elsewhere in this chapter:
- When it re-sends any PUBLISH packets, it MUST re-send them in the order in which the original PUBLISH packets were sent (this applies to
QoS 1 and QoS 2 messages) [MQTT-4.6.0-1]
- It MUST send PUBACK packets in the order in which the corresponding PUBLISH packets were received (QoS 1 messages)
[MQTT-4.6.0-2]
- It MUST send PUBREC packets in the order in which the corresponding PUBLISH packets were received (QoS 2 messages)
[MQTT-4.6.0-3]
It MUST send PUBREL packets in the order in which the corresponding PUBREC packets were received (QoS 2 messages)
[MQTT-4.6.0-4]
A Server MUST by default treat each Topic as an "Ordered Topic". It
MAY provide an administrative or other mechanism to allow one or more
Topics to be treated as an "Unordered Topic" [MQTT-4.6.0-5].
When a Server processes a message that has been published to an
Ordered Topic, it MUST follow the rules listed above when delivering
messages to each of its subscribers. In addition it MUST send PUBLISH
packets to consumers (for the same Topic and QoS) in the order that
they were received from any given Client [MQTT-4.6.0-6].
阅读后我会得出结论,消息通常会按顺序发送(除非代理专门设置为使用无序主题),但如果高 QOS 消息未被正确确认,它可能会被重新发送,这可能会导致它重新交付时乱序。
如果只有一个代理、一个发布者、一个主题和干净的会话,在这种简化的情况下,
能否保证订阅者端的消息传递顺序与发布者端的发送顺序相同?会不会受到QoS的影响?
第 4.6 from the MQTT 3.1.1 spec 部分涵盖消息排序:
4.6 Message ordering
A Client MUST follow these rules when implementing the protocol flows defined elsewhere in this chapter:
- When it re-sends any PUBLISH packets, it MUST re-send them in the order in which the original PUBLISH packets were sent (this applies to QoS 1 and QoS 2 messages) [MQTT-4.6.0-1]
- It MUST send PUBACK packets in the order in which the corresponding PUBLISH packets were received (QoS 1 messages) [MQTT-4.6.0-2]
- It MUST send PUBREC packets in the order in which the corresponding PUBLISH packets were received (QoS 2 messages) [MQTT-4.6.0-3] It MUST send PUBREL packets in the order in which the corresponding PUBREC packets were received (QoS 2 messages) [MQTT-4.6.0-4]
A Server MUST by default treat each Topic as an "Ordered Topic". It MAY provide an administrative or other mechanism to allow one or more Topics to be treated as an "Unordered Topic" [MQTT-4.6.0-5].
When a Server processes a message that has been published to an Ordered Topic, it MUST follow the rules listed above when delivering messages to each of its subscribers. In addition it MUST send PUBLISH packets to consumers (for the same Topic and QoS) in the order that they were received from any given Client [MQTT-4.6.0-6].
阅读后我会得出结论,消息通常会按顺序发送(除非代理专门设置为使用无序主题),但如果高 QOS 消息未被正确确认,它可能会被重新发送,这可能会导致它重新交付时乱序。