Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

librato/rollout-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is a read-only client for rollout, except that it uses Zookeeper as the backend store instead of Redis. At Librato, we use this along side of the rollout-zk plugin.

Getting started

Add the dependency to your pom.xml:

<dependency>
    <groupId>com.librato.rollout</groupId>
    <artifactId>rollout</artifactId>
    <version>0.15</version>
</dependency>

If you don't have it already, also add jackson as a dependency:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.8.5</version>
</dependency>

First create your CuratorFramework and pass that into a new RolloutZKClient along with the Zookeeper path used in rollout, then pass that along to a new RolloutClient:

CuratorFramework framework = CuratorFrameworkFactory.builder()
        .connectString("localhost:2181")
        .retryPolicy(new RetryNTimes(1, 100))
        .build();
framework.start();

RolloutClient client = new RolloutZKClient(framework, "/rollout/users");
client.start(); // You must call start for this to connect to Zookeeper and set watches

Now you may use the client to confirm feature flags for any long ID and List<String> of groups for a given user:

if (client.userFeatureActive("some_feature", myUser.getId(), myUser.getGroups()) {
    /* do something */
}

Testing

First, you must have Zookeeper running locally on localhost:2181.

mvn test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages