Flag update flow

2 minute read

This section describes how the changes in CloudBees Feature Management affect flag values on the end device (mobile, web, backend, etc.) and how these changes can be controlled by the developer.

Refer to Resiliency to learn how CloudBees Feature Management is protected from outages and latency issues.

Client-side SDK setup flow

The client SDK setup flow operates in the following sequence:

  1. Synchronous local storage fetching:

    • The application calls the Rox SDK setup function

    • The SDK checks for existing configuration in local storage

    • The configuration is applied synchronously

    • Setup function returns with all configured flags applied on the device

  2. Asynchronous network fetching

    • In Parallel to the local storage flow, an asynchronous network request is called from the SDK to the CloudBees Feature Management Storage services

    • When the network request is returned:

      • Configuration is applied

      • Configuration is saved on local storage

Client side update flow
Figure 1. The client-side SDK update flow

SDK foreground configuration fetching flow

On relevant clients (mobile, TV, etc.) when the SDK identifies a foreground event, it triggers an asynchronous configuration fetching sequence to get a new configuration (if one exists) on CloudBees Feature Management servers.

Configuration fetching
Figure 2. The SDK foreground configuration fetching flow

Flag freeze

Refer to Understanding a flag freeze for information on when and how to freeze and unfreeze flags.

Server-side SDK update flow

Server-side SDKs fetch a new configuration file periodically. The various settings for each SDK are listed below:

SDKDefault (in seconds)Minimum (in seconds)

JVM

60

30

.NET

60

30

Node.js

60

30

JS SSR

60

30

Python

60

30

Go

60

30 (refer to Additional notes)

PHP

30

30 (refer to Additional notes)

C

60

30 (refer to Additional notes)

C++

60

30 (refer to Additional notes)

To change the default time frame, use FetchInterval / fetchIntervalInSec at the RoxOptions object, example:

JVM
.NET
Node.js
Python
Go
PHP
C
C++
RoxOptions options = new RoxOptions.Builder()
  .withFetchIntervalInSeconds(50)
  .withVersion("1.2.0")
  .build();
Rox.setup(this, options);
RoxOptions options = new RoxOptions(new RoxOptions.RoxOptionsBuilder{
    Version = "1.0.4",
    FetchInterval = 60
});
await Rox.Setup(appKey, options);
Rox.register('', container);
const options = {
  version: '2.0.0',
  fetchIntervalInSec: 60
};
Rox.setup(ROLLOUT_KEY, options);
from rox.server.rox import Rox
from rox.server.rox_options import RoxOptions

# setup configuration_fetched_handler in the options object
options = RoxOptions(
    version="1.3.1"
    fetch_interval=60
)
cancel_event = Rox.setup('<key>', options).result();
import (
  "time"
  "github.com/rollout/rox-go/server"
  "github.com/rollout/rox-go/core/model"
)

var rox *server.Rox

func setupRollout() {
  options := server.NewRoxOptions(server.RoxOptionsBuilder{
    Version: "2.0.0",
    FetchInterval: time.Minute })
  rox = server.NewRox()
}
use Rox\Server\Rox;
use Rox\Server\RoxOptions;
use Rox\Server\RoxOptionsBuilder;

$roxOptionsBuilder = (new RoxOptionsBuilder())
    ->setVersion("2.0.0")
  ->setConfigFetchIntervalInSeconds(60);

Rox::setup(ROLLOUT_KEY, new RoxOptions($roxOptionsBuilder));
#include <rox/server.h>

RoxOptions *options = rox_options_create();
rox_options_set_fetch_interval(options, 60);
rox_setup(DEFAULT_API_KEY, options);
#include <roxx/server.h>

Rox::Options *options = Rox::OptionsBuilder()
    .SetFetchInterval(60)
    .Build();

Rox::Setup(DEFAULT_API_KEY, options);

Configuration fetched handler

See Configuration fetched handler for information on how to identify when the SDKs have loaded the configuration from the local storage or network.

Additional notes

  • Go - The optional parameter type is time.duration and is in nano-seconds.

  • C/C++ - There is an additional 0 option permitted to indicate that the fetch is not periodic.

  • PHP - PHP is different from other server side SDKs as it’s not a live server, but a cache on the storage with a strategy that expires every 30 seconds. CloudBees uses Kevinrob\GuzzleCache\CacheMiddleware with a strategy.