Configuring Store and Forward

Since an Observation can be configured to Store and Forward events, Octave edge devices include the /cloudInterface/store_forward Resource and it's sub-resources which allow you to configure and control the Store and Forward behaviour.

This Resource has an internal clock that is used as the Store and Forward message timer. When an Observation is configured with Store and Forward to send events to the cloud, the Octave edge device waits, at maximum, for the specified time period before establishing a connection and sending all stored events.

If no other "Cloud Stream" communications take place between the device and Octave after the timeout (in seconds) defined by this timer, Octave will initiate a Store and Forward operation and report everything hit has stored to the Octave Cloud.

If a "Cloud Stream" communication takes place while data is waiting to be sent in the Store and Forward: all the stored data will be sent, triggered by the Cloud Stream communication

Configuring Basic Store and Forward

The steps below show how to configure the /cloudInterface/store_forward Resource to control the maximum amount of time to wait before sending data:

  1. Navigate to Build > Device > Resources.
  2. Locate /cloudInterface/store_forward.
  3. Edit Period and set the number of seconds. This specifies the maximum amount of time to wait before sending data. Also ensure that the checkbox for the Period is checked.
  4. Click Apply to apply the settings to the device.

For a complete list of Store and Forward parameters see the Store and Forward reference guide.

🚧

Notes

Data from the Store and Forward can be sent before the timer elapses: when a "cloud stream" Observation has data to send or if an Edge Action returns data to 'cl://', the Store and forward is flushed.

You can trigger data from the Store and Forward to be sent by calling the /cloudInterface/store_forward/flush trigger.

If you send something as Cloud Immediate and there is content in the Store and Forward buffer, Octave will piggyback the Store and Forward data as well, and reset the timer.

Store and Forward is emptied immediately when "Cloud Stream" data is sent, the period has elapsed, or Store and Forward is triggered.

When Developer Mode is enabled, device reports its status every minute: this will empty the Store and Forward. It is therefore recommended to disable Developer Mode when testing Store and Forward

Configuring and Understanding Heartbeat

After configuring Store and Forward for an Octave edge device (via the /cloudInterface/store_forward/period Resource), each communication of data sent to the cloud, updates the last known online status of the device in Octave. However, it can be useful to have the device perform this refresh even if there isn't anything in the Store and Forward buffer.

You can enable this heartbeat functionality by enabling the heartbeat_on_empty property of the /cloudInterface/store_forward Resource. When enabled, the device will send a message to the cloud to update the last time the device was seen, regardless of whether there is anything in the Store and Forward buffer. This lets the cloud know that the device is online and operating.

The steps below show how to configure the device's heartbeat:

  1. Configure Store and Forward.
  2. During configuration, locate the /cloudInterface/store_forward/heatbeat_on_empty property and enable it. Enabling this property ensures that the device will send heartbeat data at the time specified in Period, even if there is no data buffered up. Disabling this option means the device effectively goes offline until it has data to send.
  3. Click Apply to apply the settings to the device.

Sending Data in an Edge Action Using Store and Forward

To send data using Store and Forward in an Edge Action, return the data in an st:// element. The following example shows how to send send a light reading using Store and Forward in an Edge Action:

function(event) {
  var light_reading = Resource.readValue('/redSensor/light/value');
    
  return {
  'st://': [light_reading]
  }
}

👍

Tip

When transforming data to st://, all the Events will be combined in the same message (up to 20 datapoints) when the Store and Forward timer triggers. This makes it more efficient from a Billing perspective.

Monitor the Store and Forward Level

🚧

Monitor the Store and Forward level to control your data flow.

This feature was added to the Octave 3.0 Edge release.

It is meant to be used locally on the device to control data transfer flows (i.e., to be Observed by an Edge Action or to be routed to an ORP Resource by an Observation).

The Store and Forward level is provided as a percentage of its 5 MB capacity.

The Store and forward "level" section allows you to monitor how full the Store and Forward is, and to take action upon it.

Use the following properties to configure this:

  • /cloudInterface/store_forward/level/enable to enable this feature

  • /cloudInterface/store_forward/level/period to define its period

Control Store and Forward Persistence

The /cloudInterface/store_forward/level/value Resource will be updated accordingly and report the Store and Forward level as a percentage.

The Store and Forward can be persisted, for instance, to keep the data to be sent stored on the device when it is power cycled or goes to Ultra Low Power Mode. In order to do enable this, use the /cloudInterface/store_forward/persistence/enable and /cloudInterface/store_forward/persistence/period to store the data remaining to be sent periodically.

Or trigger the saving of the data that has yet to be sent by calling /cloudInterface/store_forward/persistence/trigger before performing a power cycle or Ultra Low Power Mode transition.

The latter approach is strongly preferred to avoid saving on the local storage too frequently.