Giter Club home page Giter Club logo

rollout-java's Introduction

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

Note: This is using an old version of Curator as the backend for Zookeeper because we use Storm 0.8 in production and have inherited it. It should be simple to update this to a newer Curator should anyone require it. Patches are welcome.

Getting started

Add the dependency to your pom.xml:

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

First create your CuratorFramework and pass that into a new ZookeeperAdapter 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();

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

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

rollout-java's People

Contributors

lucky avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.