ConfigCat Java SDK

ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.

License

License

Categories

Categories

CLI User Interface config Application Layer Libs Configuration
GroupId

GroupId

com.configcat
ArtifactId

ArtifactId

configcat-client
Last Version

Last Version

2.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

ConfigCat Java SDK
ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.
Project URL

Project URL

https://github.com/configcat/java-sdk
Project Organization

Project Organization

ConfigCat
Source Code Management

Source Code Management

https://github.com/configcat/java-sdk

Download configcat-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.configcat/configcat-client/ -->
<dependency>
    <groupId>com.configcat</groupId>
    <artifactId>configcat-client</artifactId>
    <version>2.1.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.configcat/configcat-client/
implementation 'com.configcat:configcat-client:2.1.4'
// https://jarcasting.com/artifacts/com.configcat/configcat-client/
implementation ("com.configcat:configcat-client:2.1.4")
'com.configcat:configcat-client:jar:2.1.4'
<dependency org="com.configcat" name="configcat-client" rev="2.1.4">
  <artifact name="configcat-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.configcat', module='configcat-client', version='2.1.4')
)
libraryDependencies += "com.configcat" % "configcat-client" % "2.1.4"
[com.configcat/configcat-client "2.1.4"]

Dependencies

compile (4)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 3.9.1
org.slf4j : slf4j-api jar 1.7.25
com.google.code.gson : gson jar 2.8.2
commons-codec : commons-codec jar 1.11

Project Modules

There are no modules declared in this project.

ConfigCat SDK for Java

https://configcat.com

ConfigCat SDK for Java provides easy integration for your application to ConfigCat.

ConfigCat is a feature flag and configuration management service that lets you separate feature releases from code deployments. You can turn features ON or OFF using the ConfigCat Dashboard even after they are deployed. ConfigCat lets you target specific groups of users based on region, email, or any other custom user attribute.

ConfigCat is a hosted feature flag service that lets you manage feature toggles across frontend, backend, mobile, and desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.

Build Status Maven Central Coverage Status Javadocs License

Getting started

1. Install the ConfigCat SDK

Maven:

<dependency>
  <groupId>com.configcat</groupId>
  <artifactId>configcat-java-client</artifactId>
  <version>[6.0.0,)</version>
</dependency>

Gradle:

compile group: 'com.configcat', name: 'configcat-java-client', version: '6.+'

2. Go to the Connect your applications tab to get your SDK Key:

SDK-KEY

3. Import com.configcat.* in your application code

import com.configcat.*;

4. Create a ConfigCat client instance

ConfigCatClient client = new ConfigCatClient("#YOUR-SDK-KEY#");

5. Get the setting's value:

boolean isMyAwesomeFeatureEnabled = client.getValue(Boolean.class, "isMyAwesomeFeatureEnabled", false);
if(isMyAwesomeFeatureEnabled) {
    doTheNewThing();
} else{
    doTheOldThing();
}

Or use the async APIs:

client.getValueAsync(Boolean.class, "isMyAwesomeFeatureEnabled", false)
    .thenAccept(isMyAwesomeFeatureEnabled -> {
        if(isMyAwesomeFeatureEnabled) {
            doTheNewThing();
        } else{
            doTheOldThing();
        }
    });

Getting user-specific setting values with Targeting

Using this feature, you will be able to get different setting values for different users in your application by passing a User Object to the getValue() function.

Read more about Targeting here.

User Object

Percentage and targeted rollouts are calculated by the user object passed to the configuration requests. The user object must be created with a mandatory identifier parameter which uniquely identifies each user:

User user = User.newBuilder()
        .build("#USER-IDENTIFIER#"); // mandatory

boolean isMyAwesomeFeatureEnabled = client.getValue(Boolean.class, "isMyAwesomeFeatureEnabled", user, false);
if(isMyAwesomeFeatureEnabled) {
    doTheNewThing();
} else{
    doTheOldThing();
}

Sample/Demo app

Polling Modes

The ConfigCat SDK supports three different polling mechanisms to acquire the setting values from ConfigCat. After the latest setting values are downloaded, they are stored in an internal cache . After that, all requests are served from the cache. Read more about Polling Modes and how to use them at ConfigCat Java Docs or ConfigCat Android Docs.

Support

If you need help using this SDK, feel free to contact the ConfigCat Staff at https://configcat.com. We're happy to help.

Contributing

Contributions are welcome.

About ConfigCat

com.configcat

ConfigCat

ConfigCat is a managed feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Management app + feature flag SDKs.

Versions

Version
2.1.4
2.1.2
2.1.1
2.1.0
2.0.1
1.2.3
1.2.1
1.1.3
1.1.2
1.1.1