initial sidecar impl.
use netflix-ribbon configuration
This commit is contained in:
@@ -36,6 +36,10 @@
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-jackson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.feign</groupId>
|
||||
<artifactId>feign-slf4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.cloud.consul.client;
|
||||
|
||||
import feign.Param;
|
||||
import feign.RequestLine;
|
||||
import org.springframework.cloud.consul.model.Service;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -21,5 +21,5 @@ public interface AgentClient {
|
||||
void register(Service service);
|
||||
|
||||
@RequestLine("PUT /v1/agent/service/deregister/{serviceId}")
|
||||
void deregister(@Named("serviceId") String serviceId);
|
||||
void deregister(@Param("serviceId") String serviceId);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.cloud.consul.client;
|
||||
|
||||
import feign.Param;
|
||||
import feign.RequestLine;
|
||||
import org.springframework.cloud.consul.model.ServiceNode;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -15,5 +15,5 @@ public interface CatalogClient {
|
||||
Map<String, List<String>> getServices();
|
||||
|
||||
@RequestLine("GET /v1/catalog/service/{serviceId}")
|
||||
List<ServiceNode> getServiceNodes(@Named("serviceId") String serviceId);
|
||||
List<ServiceNode> getServiceNodes(@Param("serviceId") String serviceId);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.springframework.cloud.consul.client;
|
||||
|
||||
import feign.Param;
|
||||
import feign.RequestLine;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.consul.model.Event;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
public interface EventClient {
|
||||
//?node=, ?service=, and ?tag= ?dc=
|
||||
@RequestLine("PUT /v1/event/fire/{name}")
|
||||
Event fire(@Named("name") String name, String payload);
|
||||
Event fire(@Param("name") String name, String payload);
|
||||
|
||||
//?name=
|
||||
//?wait=<interval>&index=<idx>
|
||||
@@ -24,5 +24,5 @@ public interface EventClient {
|
||||
Response getEventsResponse();
|
||||
|
||||
@RequestLine("GET /v1/event/list?wait={wait}&index={index}")
|
||||
Response watch(@Named("wait") String wait, @Named("index") String index);
|
||||
Response watch(@Param("wait") String wait, @Param("index") String index);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ package org.springframework.cloud.consul.client;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.base.Throwables;
|
||||
import feign.Param;
|
||||
import feign.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.consul.model.Event;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Named;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
@@ -46,7 +46,7 @@ public class EventService {
|
||||
return lastIndex.get();
|
||||
}
|
||||
|
||||
public Event fire(@Named("name") String name, String payload) {
|
||||
public Event fire(@Param("name") String name, String payload) {
|
||||
return client.fire(name, payload);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.springframework.cloud.consul.client;
|
||||
|
||||
import feign.Param;
|
||||
import feign.RequestLine;
|
||||
import org.springframework.cloud.consul.model.KeyValue;
|
||||
|
||||
import javax.inject.Named;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -11,23 +11,23 @@ import java.util.List;
|
||||
*/
|
||||
public interface KeyValueClient {
|
||||
@RequestLine("GET /v1/kv/{key}")
|
||||
List<KeyValue> getKeyValue(@Named("key") String key);
|
||||
List<KeyValue> getKeyValue(@Param("key") String key);
|
||||
|
||||
@RequestLine("GET /v1/kv/?recurse=true")
|
||||
List<KeyValue> getKeyValueRecurse();
|
||||
|
||||
@RequestLine("GET /v1/kv/{key}?recurse=true")
|
||||
List<KeyValue> getKeyValueRecurse(@Named("key") String key);
|
||||
List<KeyValue> getKeyValueRecurse(@Param("key") String key);
|
||||
|
||||
@RequestLine("GET /v1/kv/?keys=true")
|
||||
List<String> getKeys();
|
||||
|
||||
@RequestLine("GET /v1/kv/{key}?keys=true")
|
||||
List<String> getKeys(@Named("key") String key);
|
||||
List<String> getKeys(@Param("key") String key);
|
||||
|
||||
@RequestLine("PUT /v1/kv/{key}")
|
||||
boolean put(@Named("key") String key, Object value);
|
||||
boolean put(@Param("key") String key, Object value);
|
||||
|
||||
@RequestLine("DELETE /v1/kv/{key}")
|
||||
void delete(@Named("key") String key);
|
||||
void delete(@Param("key") String key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user