当 AWS IOT 设备断开连接并重新连接时,传输中的消息会发生什么
What happens with messages in flight when a AWS IOT device disconnects and reconnects
我有一台设备(又称 'thing')成功连接到 AWS IOT。该设备将在使用移动网络的非常不可靠的电信环境中运行。这意味着当我的应用程序处于 运行.
时,此设备将频繁连接和重新连接
我知道 AWS IOT 'shadow' 机制,但我的消息需要按顺序使用,这意味着我需要所有消息,而不仅仅是最后一个状态。
在断开连接和重新连接事件期间,传输中的消息和负载会发生什么情况?
我假设您正在使用 MQTT 进行通信。既然如此,这段摘录自AWS IoT Developer Guide:
MQTT is a widely adopted lightweight messaging protocol designed for
constrained devices. For more information, go to MQTT. Although the
AWS IoT message broker implementation is based on MQTT v3.1.1, it
deviates from the specification as follows:
- In AWS IoT, subscribing to a topic with Quality of Service (QoS) 0 means a message will be delivered zero or more times. A message may be
delivered more than once. Messages delivered more than once may be
sent with a different packet ID. In these cases, the DUP flag is not
set.
- AWS IoT does not support publishing and subscribing with QoS 2. The AWS IoT message broker does not send a PUBACK or SUBACK when QoS 2 is
requested.
- [...]
- The message broker does not supports persistent sessions (clean session set to 0). All sessions are assumed to be clean sessions and
messages are not stored across sessions. If an MQTT client sends a
message with the clean session attribute set to false, the client will
be disconnected.
- On rare occasions, the message broker may resend the same logical publish message with a different packet ID.
- The message broker does not guarantee the order in which messages and ACK are received.
也就是说,AWS IoT MQTT 实施无法保证您设备消息的任何特定顺序。如果您绝对需要按顺序读取该数据,您可以实施某种方法来对数据进行分区并在设备影子状态中插入元数据,并使用 AWS IoT 规则或 AWS Lambda 对数据进行重新排序。
我有一台设备(又称 'thing')成功连接到 AWS IOT。该设备将在使用移动网络的非常不可靠的电信环境中运行。这意味着当我的应用程序处于 运行.
时,此设备将频繁连接和重新连接我知道 AWS IOT 'shadow' 机制,但我的消息需要按顺序使用,这意味着我需要所有消息,而不仅仅是最后一个状态。
在断开连接和重新连接事件期间,传输中的消息和负载会发生什么情况?
我假设您正在使用 MQTT 进行通信。既然如此,这段摘录自AWS IoT Developer Guide:
MQTT is a widely adopted lightweight messaging protocol designed for constrained devices. For more information, go to MQTT. Although the AWS IoT message broker implementation is based on MQTT v3.1.1, it deviates from the specification as follows:
- In AWS IoT, subscribing to a topic with Quality of Service (QoS) 0 means a message will be delivered zero or more times. A message may be delivered more than once. Messages delivered more than once may be sent with a different packet ID. In these cases, the DUP flag is not set.
- AWS IoT does not support publishing and subscribing with QoS 2. The AWS IoT message broker does not send a PUBACK or SUBACK when QoS 2 is requested.
- [...]
- The message broker does not supports persistent sessions (clean session set to 0). All sessions are assumed to be clean sessions and messages are not stored across sessions. If an MQTT client sends a message with the clean session attribute set to false, the client will be disconnected.
- On rare occasions, the message broker may resend the same logical publish message with a different packet ID.
- The message broker does not guarantee the order in which messages and ACK are received.
也就是说,AWS IoT MQTT 实施无法保证您设备消息的任何特定顺序。如果您绝对需要按顺序读取该数据,您可以实施某种方法来对数据进行分区并在设备影子状态中插入元数据,并使用 AWS IoT 规则或 AWS Lambda 对数据进行重新排序。