LaunchDarkly Java SDK DynamoDB integration

DynamoDB-backed feature store for the LaunchDarkly Java SDK

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.launchdarkly
ArtifactId

ArtifactId

launchdarkly-client-dynamodb-store
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

LaunchDarkly Java SDK DynamoDB integration
DynamoDB-backed feature store for the LaunchDarkly Java SDK
Project URL

Project URL

https://github.com/launchdarkly/java-client-dynamodb
Source Code Management

Source Code Management

https://github.com/launchdarkly/java-client-dynamodb

Download launchdarkly-client-dynamodb-store

How to add to project

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

Dependencies

runtime (3)

Group / Artifact Type Version
com.launchdarkly : launchdarkly-client jar 4.6.0
software.amazon.awssdk : dynamodb jar 2.1.4
org.slf4j : slf4j-api jar 1.7.21

Project Modules

There are no modules declared in this project.

LaunchDarkly SDK for Java - DynamoDB integration

Circle CI Javadocs

This library provides a DynamoDB-backed persistence mechanism (data store) for the LaunchDarkly Java SDK, replacing the default in-memory data store.

This version of the library requires at least version 5.0.0 of the LaunchDarkly Java SDK, and at least version 2.1 of the AWS SDK for Java. The minimum Java version is 8. For Java SDK 4.x, use the latest 2.x version of this library.

If you need to use Java 7, or if you are already using AWS SDK 1.x for some other purpose, you can use the 1.x releases of this library (which are developed on the "aws-v1" branch of the repository).

See the API documentation for details on classes and methods.

For more information, see also: Using a persistent data store.

Quick setup

This assumes that you have already installed the LaunchDarkly Java SDK.

  1. In DynamoDB, create a table which has the following schema: a partition key called "namespace" and a sort key called "key", both with a string type. The LaunchDarkly library does not create the table automatically, because it has no way of knowing what additional properties (such as permissions and throughput) you would want it to have.

  2. Add this library to your project (updating the version number to use the latest release):

     <dependency>
       <groupId>com.launchdarkly</groupId>
       <artifactId>launchdarkly-java-server-sdk-dynamodb-store</artifactId>
       <version>3.0.0</version>
     </dependency>
    
  3. If you do not already have the AWS SDK in your project, add the DynamoDB part of it. (This needs to be added separately, rather than being included in the LaunchDarkly jar, because AWS classes are exposed in the public interface.)

     <dependency>
       <groupId>software.amazon.awssdk</groupId>
       <artifactId>dynamodb</artifactId>
       <version>2.1.4</version>
     </dependency>
    
  4. Import the LaunchDarkly package and the package for this library:

     import com.launchdarkly.sdk.server.*;
     import com.launchdarkly.sdk.server.integrations.*;
    
  5. When configuring your SDK client, add the DynamoDB feature store:

     LDConfig config = new LDConfig.Builder()
         .dataStore(
             Components.persistentDataStore(
                 DynamoDb.dataStore("my-table-name")
             )
         )
         .build();
    

By default, the DynamoDB client will try to get your AWS credentials and region name from environment variables and/or local configuration files, as described in the AWS SDK documentation. There are methods in DynamoDbDataStoreBuilder for changing the configuration options. Alternatively, if you already have a fully configured DynamoDB client object, you can tell LaunchDarkly to use that:

            Components.persistentDataStore(
                DynamoDb.dataStore("my-table-name").existingClient(myDynamoDbClientInstance)
            )

Caching behavior

The LaunchDarkly SDK has a standard caching mechanism for any persistent data store, to reduce database traffic. This is configured through the SDK's PersistentDataStoreBuilder class as described the SDK documentation. For instance, to specify a cache TTL of 5 minutes:

    LDConfig config = new LDConfig.Builder()
        .dataStore(
            Components.persistentDataStore(
                DynamoDb.dataStore("my-table-name")
            ).cacheTime(Duration.ofMinutes(5))
        )
        .build();

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out our documentation for a complete list.
  • Explore LaunchDarkly
com.launchdarkly

LaunchDarkly

Fast and reliable feature management for the modern enterprise

Versions

Version
2.0.0
1.0.0