This is a [feign] (https://github.com/Netflix/feign) extension that supports using ranger discovered nodes as target. Also, this extension supports other modules like feign-hystrix which allows the http calls are wrapped inside a Hystrix command which allows granular control of execution environment. This library compiles only on Java 8.
Feign Ranger extension provides a easy way to enable providing service node discovery environments. Using service discovery with feign brings the ease of use of feign in a dynamic environment where providing target host port is counter productive or not possible (when applications are running in mesos/dcos).
Clone the source: git clone github.com/phaneesh/feign-ranger
Build
mvn install
Use the following repository:
<repository>
<id>clojars</id>
<name>Clojars repository</name>
<url>https://clojars.org/repo</url>
</repository>
Use the following maven dependency:
<dependency>
<groupId>feign.ranger</groupId>
<artifactId>feign-ranger</artifactId>
<version>0.1.3</version>
</dependency>
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
static class TestResponse {
private String message;
}
interface TestApi {
@RequestLine("GET /v1/test")
TestResponse test();
}
CuratorFramework curator = CuratorFrameworkFactory.builder()
.connectString(testingCluster.getConnectString())
.namespace("test")
.retryPolicy(new RetryForever(3000))
.build();
ObjectMapper objectMapper = new ObjectMapper();
TestApi api = Feign.builder()
.decoder(new JacksonDecoder())
.encoder(new JacksonEncoder())
.target(new RangerTarget<>(TestApi.class, "test", "test", "test", curator, false, objectMapper));
TestResponse response = api.test();
Copyright 2016 Phaneesh Nagaraja phaneesh.n@gmail.com.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close