The Vect SDK provides a safe and easy way to access the parameters you manage in app.vect.io, allowing you to read parameters and react to changes with fault tolerance.

Getting Started

Installation

Install the local SDK server:

(
export VECT_AUTH=<your Vect credentials>;
/bin/bash -c "$(curl -fsSL <https://gist.githubusercontent.com/vect-bot/4ac5f4f150c271a1c64b7da74460508c/raw/install-vect-sdk-daemon.sh>)"
)

Download the SDK JAR and add it to your classpath:

kotlin-vect-sdk-0.0.1-all.jar.zip

Initializing

Start the Vect daemon in the background by running:

(cd ~/.vect/sdk/grpc-vect-sdk && node dist/src/scripts/init-daemon.js)

Initialize your Vect repository client using the provided API keys and Vect repository name:

import io.vect.sdk.VectRepository;
import io.vect.sdk.ApiKey;

public class Main {
    public static void main(String[] args) {
        ApiKey apiKey = new ApiKey("acme-v2022-1", "hfrT7feFHW89FHAoRABVaw12D");
        VectRepository vectRepo = new VectRepository("acme-com/acme-v2022-1", apiKey);
        // ...
    }
}

Accessing Parameters

To subscribe to a file, use VectRepo.watchFile to keep the parameters up-to-date and cached for fault tolerance.

Get Accessor

To access the current state of a file:

Watcher bazWatcher = vectRepo.watchFile("foo/bar/baz.json")
System.out.printf("foo/bar/baz.json: %s", bazWatcher.getLatestBlocking());

getLatestBlocking returns the latest value of bazWatcher instantly without a network request after the initial run.

API