public interface ConsulOperations
Modifier and Type | Method and Description |
---|---|
Publisher<Boolean> |
deregister(@NotNull CatalogEntry entry)
Register a new
CatalogEntry . |
Publisher<HttpStatus> |
deregister(@NotNull String service)
Register a new
CatalogEntry . |
default Publisher<HttpStatus> |
fail(String checkId)
Fail the TTL check.
|
Publisher<HttpStatus> |
fail(String checkId,
String note)
Fail the TTL check.
|
default Publisher<List<HealthEntry>> |
getHealthyServices(@NotNull String service)
Gets service health information.
|
Publisher<List<HealthEntry>> |
getHealthyServices(@NotNull String service,
Boolean passing,
String tag,
String dc)
Gets the healthy services that are passing health checks.
|
Publisher<List<MemberEntry>> |
getMembers()
Returns the members the agent sees in the cluster gossip pool.
|
Publisher<List<CatalogEntry>> |
getNodes()
Gets all of the registered nodes.
|
Publisher<List<CatalogEntry>> |
getNodes(@NotNull String datacenter)
Gets all the nodes for the given data center.
|
Publisher<LocalAgentConfiguration> |
getSelf()
Returns the configuration and member information of the local agent.
|
Publisher<Map<String,List<String>>> |
getServiceNames()
Gets all of the service names and optional tags.
|
Publisher<Map<String,ServiceEntry>> |
getServices()
Gets all of the registered services.
|
default Publisher<HttpStatus> |
pass(String checkId)
Pass the TTL check.
|
Publisher<HttpStatus> |
pass(String checkId,
String note)
Pass the TTL check.
|
Publisher<Boolean> |
putValue(String key,
String value)
Writes a value for the given key to Consul.
|
Publisher<List<KeyValue>> |
readValues(String key)
Reads a Key from Consul.
|
Publisher<List<KeyValue>> |
readValues(String key,
String datacenter,
Boolean raw,
String seperator)
Reads a Key from Consul.
|
Publisher<Boolean> |
register(@NotNull CatalogEntry entry)
Register a new
CatalogEntry . |
Publisher<HttpStatus> |
register(@NotNull NewServiceEntry entry)
Register a new
CatalogEntry . |
Publisher<String> |
status() |
default Publisher<HttpStatus> |
warn(String checkId)
Warn the TTL check.
|
Publisher<HttpStatus> |
warn(String checkId,
String note)
Warn the TTL check.
|
@Put(value="/kv/{+key}", processes="text/plain", single=true) Publisher<Boolean> putValue(String key, @Body String value)
key
- The keyvalue
- The value as a StringPublisher
that emits a boolean if the operation succeeded@Get(uri="/kv/{+key}?recurse", single=true) Publisher<List<KeyValue>> readValues(String key)
@Get(uri="/kv/{+key}?recurse=true{&dc}{&raw}{&seperator}", single=true) @Retryable(attempts="${consul.client.config.retry-count:3}", delay="${consul.client.config.retry-delay:1s}") Publisher<List<KeyValue>> readValues(String key, @Nullable @QueryValue(value="dc") String datacenter, @Nullable Boolean raw, @Nullable String seperator)
@Put(value="/agent/check/pass/{checkId}{?note}") @Retryable(attempts="${consul.client.registration.retry-count:10}", delay="${consul.client.registration.retry-delay:3s}") Publisher<HttpStatus> pass(String checkId, @Nullable String note)
checkId
- The check IDnote
- An optional noteHttpStatus
of HttpStatus.OK
if all is well@Put(value="/agent/check/warn/{checkId}{?note}") Publisher<HttpStatus> warn(String checkId, @Nullable String note)
checkId
- The check IDnote
- An optional noteHttpStatus
of HttpStatus.OK
if all is well@Put(value="/agent/check/fail/{checkId}{?note}") @Retryable(attempts="${consul.client.registration.retry-count:10}", delay="${consul.client.registration.retry-delay:3s}") Publisher<HttpStatus> fail(String checkId, @Nullable String note)
checkId
- The check IDnote
- An optional noteHttpStatus
of HttpStatus.OK
if all is well@Get(uri="/status/leader", single=true) @Retryable Publisher<String> status()
@Put(uri="/catalog/register", single=true) Publisher<Boolean> register(@NotNull @Body @NotNull CatalogEntry entry)
CatalogEntry
. See https://www.consul.io/api/catalog.html.entry
- The entry to registerPublisher
that emits a boolean true if the operation was successful@Put(uri="/catalog/deregister", single=true) Publisher<Boolean> deregister(@NotNull @Body @NotNull CatalogEntry entry)
CatalogEntry
. See https://www.consul.io/api/catalog.html.entry
- The entry to registerPublisher
that emits a boolean true if the operation was successful@Put(value="/agent/service/register") @Retryable(attempts="${consul.client.registration.retry-count:10}", delay="${consul.client.registration.retry-delay:3s}") Publisher<HttpStatus> register(@NotNull @Body @NotNull NewServiceEntry entry)
CatalogEntry
. See https://www.consul.io/api/catalog.html.entry
- The entry to registerPublisher
that emits a boolean true if the operation was successful@Put(value="/agent/service/deregister/{service}") @Retryable(attempts="${consul.client.registration.retry-count:10}", delay="${consul.client.registration.retry-delay:3s}") Publisher<HttpStatus> deregister(@NotNull @NotNull String service)
CatalogEntry
. See https://www.consul.io/api/catalog.html.service
- The service to registerPublisher
that emits a boolean true if the operation was successful@Get(uri="/agent/services", single=true) Publisher<Map<String,ServiceEntry>> getServices()
NewServiceEntry
instances@Get(uri="/agent/members", single=true) Publisher<List<MemberEntry>> getMembers()
MemberEntry
instances@Get(uri="/agent/self", single=true) Publisher<LocalAgentConfiguration> getSelf()
LocalAgentConfiguration
instance@Get(uri="/health/service/{service}{?passing,tag,dc}", single=true) Publisher<List<HealthEntry>> getHealthyServices(@NotNull @NotNull String service, @Nullable Boolean passing, @Nullable String tag, @Nullable String dc)
service
- The servicepassing
- The passing parametertag
- The tagdc
- The dcHealthEntry
instances@Get(uri="/catalog/nodes", single=true) Publisher<List<CatalogEntry>> getNodes()
@Get(uri="/catalog/nodes?dc={datacenter}", single=true) Publisher<List<CatalogEntry>> getNodes(@NotNull @NotNull String datacenter)
datacenter
- The data center@Get(uri="/catalog/services", single=true) Publisher<Map<String,List<String>>> getServiceNames()
default Publisher<HttpStatus> pass(String checkId)
checkId
- The check IDHttpStatus
of HttpStatus.OK
if all is welldefault Publisher<HttpStatus> warn(String checkId)
checkId
- The check IDHttpStatus
of HttpStatus.OK
if all is welldefault Publisher<HttpStatus> fail(String checkId)
checkId
- The check IDHttpStatus
of HttpStatus.OK
if all is welldefault Publisher<List<HealthEntry>> getHealthyServices(@NotNull @NotNull String service)
service
- The serviceHealthEntry
instances