Skip to content

Java Client

Installation

GitHub Release

Maven

Add the FigChain repository to your pom.xml:

<repositories>
    <repository>
        <id>figchain-public</id>
        <url>https://maven.repo.figchain.io/releases</url>
    </repository>
</repositories>

Add the dependency:

<dependency>
    <groupId>io.figchain</groupId>
    <artifactId>figchain-client</artifactId>
    <version>${figchain.version}</version>
</dependency>

Gradle

Add the FigChain repository to your build.gradle:

repositories {
    maven {
        url = uri("https://maven.repo.figchain.io/releases")
    }
}

Add the dependency:

implementation 'io.figchain:figchain-client:${figchain.version}'

Add the FigChain repository to your pom.xml:

<repositories>
    <repository>
        <id>figchain-public</id>
        <url>https://maven.repo.figchain.io/releases</url>
    </repository>
</repositories>

Add the dependency:

<dependency>
    <groupId>io.figchain</groupId>
    <artifactId>figchain-client</artifactId>
    <version>${figchain.version}</version>
</dependency>

Gradle

Add the FigChain repository to your build.gradle:

repositories {
    maven {
        url = uri("https://maven.repo.figchain.io/releases")
    }
}

Add the dependency:

implementation 'io.figchain:figchain-client:${figchain.version}'

Quick Start

import io.figchain.client.FcClient;
import io.figchain.client.FcClientBuilder;
import io.figchain.client.EvaluationContext;
import figchain.generatedconfigmodel.GeneratedConfigModel; // This is from the generated schema model
import java.util.Optional;

// Build the client
FigChainClient client = new FigChainClientBuilder()
    .apiKey("your-api-key")
    .environmentId("your-environment-id")
    .namespace("default")
    .build();

String figKey = "your-fig-key";

// Register a listener for fig updates
client.registerListener(figKey, GeneratedConfigModel.class, figValue -> {
    System.out.println("Fig updated: " + figKey + " -> " + figValue);
});

// Start the client
client.start();

Optional<GeneratedConfigModel> configValue = client.getFig(figKey, GeneratedConfigModel.class);

// Shutdown when done
client.shutdown();

Requirements

  • Java 21 or later
  • Maven 3.8+ or Gradle 7+

Building from Source

mvn clean install

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Support