I am looking for more information regarding how TTL is handled on the Edge Hub in different scenarios. By default, the TTL is 7200 seconds (2 hours). Consider the following scenarios and please correct me if I'm wrong here:
Sunshine case
- System is online
- A message appears on the Edge Hub at timestamp
1
.
- The message is forwarded upstream immediately
Offline case
4. System is offline
5. A message appears on the Edge Hub at timestamp 1
6. The system remains offline for 1 hour (half the TTL)
7. When online, all received messages are forwarded to the IoT Hub
Power outage case
8. System is offline
9. A message appears on the Edge Hub at timestamp 1
10. The site loses power for 4 hours (TTL has long passed)
11. System boots up again and is now online
12. What happens to the messages in this scenario?
Say that for instance the retry interval of the edge hub is 2
, the ttl is 3
and my message is sent at 1
and is not successfully delivered. We then suffer a power outage, and the hub comes back up on when the time is 10
. Does the hub solve this scenario, or do I handle it myself?
Had a quick look at the edge module source and it looks like it uses System.currentTimeMillis()
for Java in the EdgeModule
, and if the messages timestamp is older than that a call back is fired with message status MESSAGE_EXPIRED
. So I guess either increase TTL or handle this callback?
Hope you can shed some light on this! Loving the offline features so far, has saved us a ton of work.
Update:
So I realized that looking at the Java source is only half the puzzle, since the messages should be handled by the edgeHub container. Looking at the source for that, it looks like the same logic appears again. How these two interact is beyond me.