Java client for etcd v3.
EtcdClient client = EtcdClientBuilder.newBuilder().endpoints("http://localhost:2379").build();
EtcdKV kvClient = client.getKVClient();
ByteString key = ByteString.copyFrom("test_key", "UTF-8");
ByteString value = ByteString.copyFrom("test_value", "UTF-8");
// put the key-value
kvClient.put(key, value).get();
// get the value
ListenableFuture<RangeResponse> getFeature = kvClient.get(key);
RangeResponse response = getFeature.get();
assertEquals(response.getKvsCount(), 1);
assertEquals(response.getKvs(0).getValue().toStringUtf8(), "test_value");
// delete the key
kvClient.delete(key).get()
For full etcd v3 API, plesase refer to API_Reference.
- Mailing list: etcd-dev
jetcd is under the Apache 2.0 license. See the LICENSE file for details.