简体   繁体   中英

Aws IoT Message Delivery

I am looking into Amazon IoT as a transport mechanism for mobile devices periodically measuring data (usually every N minutes, with N being anywhere between 2 and 32 minutes). With MQTT, I can utilize Amazon's broker to publish finished measurement results to subscribers with QoS=1. Let's also assume that my sole subscriber is just another device listening on wildcard topic (eg. abc/#) and storing published messages into a local database.

But now it's also possible that:

the publishing mobile devices have spotty/bad/no connection to the cell network,
the subscriber dies (reboots, software failure, hardware failure, maintenance, etc.)

Assuming I use the official Java SDK . What would happen to data published during these times when at least either of them is offline? Will the subscriber get all the messages it has been missing out on upon reconnect?

Also: does this depend on the protocol in question? For testing purposes, we're using WebSockets, but later development/production, we'd prefer MQTT over SSL.

What would happen to data published during these times when at least either of them is offline? Will the subscriber get all the messages it has been missing out on upon reconnect?

Yes, If you use MQTT with QoS Level 1 or Higher because MQTT employs a Publisher/Subscriber architecture with Topic. Messages destined to Topics with QoS Level 1 and Higher will have the messages in memory and on disk (Atleast mosquitto ) by the MQTT server until a Subscriber subscribes.

WebSocket is different. It doesn't have a Publisher/Subscriber architecture. It is a Duplex Communication model on a Single TCP connection. WebSocket initiates as a HTTP connection which will get updated to a WebSocket connection. In case of WebSocket it is the responsibility of the Application to make sure what happens when there are connection problems with Subscribers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM