etcd Java client

Simple Java client to interact with CoreOS's etcd

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.github.mlaccetti
Идентификатор

Идентификатор

etcd-client
Последняя версия

Последняя версия

0.1.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

etcd Java client
Simple Java client to interact with CoreOS's etcd
Ссылка на сайт

Ссылка на сайт

https://github.com/mlaccetti/jetcd
Система контроля версий

Система контроля версий

https://github.com/mlaccetti/jetcd

Скачать etcd-client

Как подключить последнюю версию

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.httpcomponents : httpasyncclient jar 4.1.1
com.google.guava : guava jar 19.0
com.google.code.gson : gson jar 2.6.2
org.slf4j : slf4j-api jar 1.7.19

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.19
org.slf4j : slf4j-simple jar 1.7.19

Модули Проекта

Данный проект не имеет модулей.

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("http://127.0.0.1:4001/"));

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);
Assert.assertFalse(watchFuture.isDone());

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

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

For a bit of background, check out the blog post.

Testing

  1. Export the IP for the node to use (this example is the typical IP of a docker-machine host:

    export HOST_IP="192.168.99.100"
    
  2. Fire up an etcd Docker container:

docker run -d -p 4001:4001 -p 2380:2380 -p 2379:2379 --name etcd quay.io/coreos/etcd:v2.0.3
-name etcd0
-advertise-client-urls http://${HOST_IP}:2379,http://${HOST_IP}:4001
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001
-initial-advertise-peer-urls http://${HOST_IP}:2380
-listen-peer-urls http://0.0.0.0:2380
-initial-cluster-token etcd-cluster-1
-initial-cluster etcd0=http://${HOST_IP}:2380
-initial-cluster-state new ```

Версии библиотеки

Версия
0.1.3
0.1.2
0.1.1