use of feign.Retryer in project pravega by pravega.
the class AuthEnabledMarathonClient method getInstance.
private static Marathon getInstance(String endpoint, RequestInterceptor... interceptors) {
Feign.Builder b = Feign.builder().client(LoginClient.getClientHostVerificationDisabled()).logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC).encoder(new GsonEncoder(ModelUtils.GSON)).decoder(new GsonDecoder(ModelUtils.GSON)).errorDecoder(new MarathonErrorDecoder()).retryer(new Retryer.Default(SECONDS.toMillis(1), SECONDS.toMillis(5), 5));
if (interceptors != null) {
b.requestInterceptors(asList(interceptors));
}
b.requestInterceptor(new MarathonHeadersInterceptor());
return b.target(Marathon.class, endpoint);
}
use of feign.Retryer in project feign by OpenFeign.
the class RealRequestBenchmarks method setup.
@Setup
public void setup() {
server = HttpServer.newServer(SERVER_PORT).start((request, response) -> null);
client = new OkHttpClient();
client.retryOnConnectionFailure();
okFeign = Feign.builder().client(new feign.okhttp.OkHttpClient(client)).logLevel(Level.NONE).logger(new Logger.ErrorLogger()).retryer(new Retryer.Default()).target(FeignTestInterface.class, "http://localhost:" + SERVER_PORT);
queryRequest = new Request.Builder().url("http://localhost:" + SERVER_PORT + "/?Action=GetUser&Version=2010-05-08&limit=1").build();
}
use of feign.Retryer in project feign by OpenFeign.
the class ReactiveFeignIntegrationTest method testRetryer.
@Test
public void testRetryer() {
this.webServer.enqueue(new MockResponse().setBody("Not Available").setResponseCode(-1));
this.webServer.enqueue(new MockResponse().setBody("1.0"));
Retryer retryer = new Retryer.Default();
Retryer spy = spy(retryer);
when(spy.clone()).thenReturn(spy);
TestReactorService service = ReactorFeign.builder().retryer(spy).target(TestReactorService.class, this.getServerUrl());
StepVerifier.create(service.version()).expectNext("1.0").expectComplete().verify();
verify(spy, times(1)).continueOrPropagate(any(RetryableException.class));
}
Aggregations