If you have the three apps, running the data should be automatically moved from the embedded app to the Gateway and eventually to the cloud. Even if you change the interval of the queries, the data should always be synced between the Gateway and the Cloud app.
One very useful feature of Cassandra is the Time To Live (TTL) property. In our example, the database in the Gateway app will accumulate a lot of data over time and, since we moved it to the cloud, we may want to delete it at some point. We can do that automatically by specifying TTL (in seconds) on each insert. In the following example, the record will automatically be deleted after one day:
insert into temperature (sensor_id, date, event_time, temperature) values ...