consul-api

Library for using consul

License

License

Categories

Categories

Net consul-api Container Microservices
GroupId

GroupId

net.nikore.consul
ArtifactId

ArtifactId

consul-api
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

consul-api
Library for using consul
Project URL

Project URL

https://github.com/nikore/consul-api
Source Code Management

Source Code Management

https://github.com/nikore/consul-api

Download consul-api

How to add to project

<!-- https://jarcasting.com/artifacts/net.nikore.consul/consul-api/ -->
<dependency>
    <groupId>net.nikore.consul</groupId>
    <artifactId>consul-api</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.nikore.consul/consul-api/
implementation 'net.nikore.consul:consul-api:1.0.0'
// https://jarcasting.com/artifacts/net.nikore.consul/consul-api/
implementation ("net.nikore.consul:consul-api:1.0.0")
'net.nikore.consul:consul-api:jar:1.0.0'
<dependency org="net.nikore.consul" name="consul-api" rev="1.0.0">
  <artifact name="consul-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.nikore.consul', module='consul-api', version='1.0.0')
)
libraryDependencies += "net.nikore.consul" % "consul-api" % "1.0.0"
[net.nikore.consul/consul-api "1.0.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.httpcomponents : httpcore jar 4.3.2
org.apache.httpcomponents : httpclient jar 4.3.2
com.fasterxml.jackson.core : jackson-core jar 2.4.2
com.fasterxml.jackson.core : jackson-databind jar 2.4.2
com.google.guava : guava jar 15.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

consul-api

Java client for Consul HTTP API (http://consul.io)

Supports all API endpoints (http://www.consul.io/docs/agent/http.html), all consistency modes and parameters (tags, datacenters etc.)

How to use

ConsulClient client = new ConsulClient("localhost");

// register new service
NewService newService = new NewService();
newService.setId("myapp_01");
newService.setName("myapp");
newService.setPort(8080);
client.agentServiceRegister(newService);

// KV
byte[] binaryData = new byte[] {1,2,3,4,5,6,7};
client.setKVBinaryValue("someKey", binaryData);

String value = client.getKVValue("somekey").getValue().getValue();

//list known datacenters
Response<List<String>> response = client.getCatalogDatacenters();
System.out.println("Datacenters: " + response.getValue());

Versions

Version
1.0.0