com.github.mxsm:jetcd-core

Java Client for etcd V3

License

License

Categories

Categories

jetcd Data Databases
GroupId

GroupId

com.github.mxsm
ArtifactId

ArtifactId

jetcd-core
Last Version

Last Version

0.3.7
Release Date

Release Date

Type

Type

bundle
Description

Description

Java Client for etcd V3

Download jetcd-core

Dependencies

compile (8)

Group / Artifact Type Version
com.github.mxsm : jetcd-common jar 0.3.7
com.github.mxsm : jetcd-resolver jar 0.3.7
io.grpc : grpc-core jar 1.18.0
io.grpc : grpc-netty jar 1.18.0
io.grpc : grpc-protobuf jar 1.18.0
io.grpc : grpc-stub jar 1.18.0
io.grpc : grpc-grpclb jar 1.18.0
org.slf4j : slf4j-api jar 1.7.25

test (12)

Group / Artifact Type Version
org.testng : testng jar 6.14.3
org.assertj : assertj-core jar 3.11.1
org.mockito : mockito-core jar 2.23.4
org.apache.logging.log4j : log4j-api jar 2.11.1
org.apache.logging.log4j : log4j-core jar 2.11.1
org.apache.logging.log4j : log4j-slf4j-impl jar 2.11.1
org.apache.logging.log4j : log4j-1.2-api jar 2.11.1
junit : junit jar 4.12
io.grpc : grpc-testing jar 1.18.0
io.netty : netty-tcnative-boringssl-static jar 2.0.20.Final
com.github.mxsm : jetcd-launcher jar 0.3.7
commons-io : commons-io jar 2.6

Project Modules

There are no modules declared in this project.

jetcd - A Java Client for etcd

Build Status License Maven Central GitHub release Javadocs

jetcd is the official java client for etcd v3.

Note: jetcd is work-in-progress and may break backward compatibility.

Java Versions

Java 8 or above is required.

Download

Maven

<dependency>
  <groupId>io.etcd</groupId>
  <artifactId>jetcd-core</artifactId>
  <version>${jetcd-version}</version>
</dependency>

Development snapshots are available in Sonatypes's snapshot repository.

Gradle

dependencies {
    compile "io.etcd:jetcd-core:$jetcd-version"
}

Usage

// create client
Client client = Client.builder().endpoints("http://localhost:2379").build();
KV kvClient = client.getKVClient();

ByteSequence key = ByteSequence.fromString("test_key");
ByteSequence value = ByteSequence.fromString("test_value");

// put the key-value
kvClient.put(key, value).get();

// get the CompletableFuture
CompletableFuture<GetResponse> getFuture = kvClient.get(key);

// get the value from CompletableFuture
GetResponse response = getFuture.get();

// delete the key
kvClient.delete(key).get();

For full etcd v3 API, plesase refer to API_Reference.

Examples

The examples are standalone projects that show usage of jetcd.

Launcher

The io.etcd:jetcd-launcher offers a convenient utility to programmatically start & stop an isolated etcd server. This can be very useful e.g. for integration testing, like so:

@Rule public final EtcdClusterResource etcd = new EtcdClusterResource("test-etcd", 1);
Client client = Client.builder().endpoints(etcd.cluster().getClientEndpoints()).build();

This launcher uses the Testcontainers framework. For more info and prerequisites visit testcontainers.org.

Versioning

The project follows Semantic Versioning.

The current major version is zero (0.y.z). Anything may change at any time. The public API should not be considered stable.

Running tests

The project is tested against a three node etcd setup started with the Launcher (above) :

$ mvn test
...

[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[WARNING] Tests run: 104, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 31.308 s - in TestSuite
[INFO]
[INFO] Results:
[INFO]
[WARNING] Tests run: 104, Failures: 0, Errors: 0, Skipped: 3
...
[INFO] Reactor Summary:
[INFO]
[INFO] jetcd .............................................. SUCCESS [  0.010 s]
[INFO] jetcd-core ......................................... SUCCESS [ 55.480 s]
[INFO] jetcd-discovery-dns-srv ............................ SUCCESS [  3.225 s]
[INFO] jetcd-watch-example ................................ SUCCESS [  0.291 s]
[INFO] jetcd-simple-ctl ................................... SUCCESS [  0.028 s]
[INFO] jetcd-examples ..................................... SUCCESS [  0.000 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 59.929 s
[INFO] Finished at: 2018-02-13T12:51:13-08:00
[INFO] Final Memory: 84M/443M

Contact

  • Mailing list: etcd-dev
  • IRC: #etcd on freenode.org

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

Reporting bugs

See reporting bugs for details about reporting any issues.

License

jetcd is under the Apache 2.0 license. See the LICENSE file for details.

com.github.mxsm

etcd-io

etcd Development and Communities

Versions

Version
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0