1
votes

I have one device (AKA 'thing') successfully connected to AWS IOT. This device will operate on a very unreliable telco environment using mobile networks. This means that this device will connect and reconnect frequently while my application is running.

I'm aware of AWS IOT 'shadow' mechanism, but my messages need to be consumed sequentially, this means that I need all messages, not just the last state.

What will happen with the messages and payload in flight during a disconnect and reconnect events?

1

1 Answers

3
votes

I'm assuming you are using MQTT for comunication. That being the case, this excerpt is taken from the 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.

That said, the AWS IoT MQTT implementation cannot guarantee any specific order to your devices' messages. If you absolutely need to have that data read sequentially, you can implement some way to partition the data and insert metadata in the device shadow state and have that data reordered using a AWS IoT rule or AWS Lambda.