Store-and-Forward Gateway Exercise
Store-and-Forward Gateway Exercise
Objective: Build a reliable gateway that buffers data during connectivity outages and implements intelligent synchronization.
The gateway photograph in Figure 1 identifies the hardware surfaces that must support this exercise’s buffer, local interfaces, and upstream synchronization. Use those surfaces to connect each task to a physical ingress, durable state, and egress path.
Photo: Laserlicht, CC BY-SA 4.0
Read Figure 1 from the local GPIO and peripheral interfaces to the processor, storage connection, and network ports. Sensor records enter on the field side, receive durable sequence and timestamp metadata in local storage, and leave through the network side after connectivity returns. The photograph does not itself prove reliability; it locates the resources the tasks must exercise. This ties the lab back to the running gateway contract: outage survival depends on software-defined buffering, ordering, retry, and acknowledgement evidence built on suitable hardware.
Tasks:
- Set up edge gateway (Raspberry Pi) with local storage (SQLite database or time-series DB)
- Implement data pipeline: sensors to gateway (buffer to DB) to cloud (MQTT or HTTP POST)
- Add connectivity monitoring: ping cloud endpoint every 10s; if unreachable, set offline flag
- Simulate 15-minute outage: disconnect network, accumulate 900 sensor samples (1 sample/sec); reconnect and verify all data syncs with correct timestamps
A small remote-data-logging version can start with a Raspberry Pi reading a DHT22 temperature and humidity sensor, stamping each accepted sample, saving it locally, and then sending the same record to a server or remote machine when the network path is available. Keep the payload boring and auditable: device id, sensor id, temperature, humidity, sample time, quality state, and upload attempt. That record lets the class separate three checks that are often confused in demos: the sensor was read, the gateway kept the reading, and the server received the same timestamped value.
Expected Outcome: Zero data loss during outage with proper temporal ordering after sync. Measure sync latency: 900 records should upload in <10 seconds. Understand buffer sizing: 1 GB storage handles ~10 million sensor readings at 100 bytes each = days of outages.