• Stars
  • Rank 248,724 (Top 6 %)
  • Language
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated 10 months ago


There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java binding for etcd

jetcd: Java binding for etcd

TravisCI: Build Status

CircleCI: CircleCI Status

A simple Java client library for the awesome etcd

Uses the Apache HttpAsyncClient to implement watches without blocking a thread, and Google's Guava to give us the nice ListenableFuture interface.

Check out SmokeTest.java to see how this is used (and tested), but here's a quick code example:

EtcdClient client = new EtcdClient(URI.create(""));

String key = "/watch";

EtcdResult result = this.client.set(key, "hello");
Assert.assertEquals("hello", result.value);

result = this.client.get(key);
Assert.assertEquals("hello", result.value);
ListenableFuture<EtcdResult> watchFuture = this.client.watch(key, result.index + 1);

result = this.client.set(key, "world");
Assert.assertEquals("world", result.value);

EtcdResult watchResult = watchFuture.get(100, TimeUnit.MILLISECONDS);
Assert.assertEquals("world", result.value);

For a bit of background, check out the blog post