-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[consul] using Consul Blocking Queries
- Loading branch information
1 parent
3464eb6
commit ee574a1
Showing
15 changed files
with
347 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/frogdevelopment/micronaut/consul/watch/client/IndexConsulClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.frogdevelopment.micronaut.consul.watch.client; | ||
|
||
import java.io.Closeable; | ||
import java.util.List; | ||
|
||
import org.reactivestreams.Publisher; | ||
|
||
import io.micronaut.context.annotation.Requires; | ||
import io.micronaut.discovery.consul.ConsulConfiguration; | ||
import io.micronaut.http.annotation.Get; | ||
import io.micronaut.http.annotation.QueryValue; | ||
import io.micronaut.http.client.annotation.Client; | ||
|
||
@Client(id = io.micronaut.discovery.consul.client.v1.ConsulClient.SERVICE_ID, path = "/v1", | ||
configuration = ConsulConfiguration.class) | ||
@Requires(beans = ConsulConfiguration.class) | ||
public interface IndexConsulClient extends Closeable, AutoCloseable { | ||
|
||
@Get(uri = "/kv/{+key}?{&index}", single = true) | ||
Publisher<List<KeyValue>> watchValue(String key, @QueryValue int index); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/frogdevelopment/micronaut/consul/watch/client/KeyValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.frogdevelopment.micronaut.consul.watch.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import io.micronaut.core.annotation.ReflectiveAccess; | ||
import io.micronaut.serde.annotation.Serdeable; | ||
|
||
@Serdeable | ||
@ReflectiveAccess | ||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class) | ||
public record KeyValue(@JsonProperty("ModifyIndex") int modifyIndex, | ||
@JsonProperty("Key") String key, | ||
@JsonProperty("Value") String value) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.