use of org.apache.http.HttpHeaders.RETRY_AFTER in project feign-reactive by kptfh.
the class RetryingTest method shouldFailAsNoMoreRetries.
@Test
public void shouldFailAsNoMoreRetries() {
String orderUrl = "/icecream/orders/1";
wireMockRule.stubFor(get(urlEqualTo(orderUrl)).withHeader("Accept", equalTo("application/json")).willReturn(aResponse().withStatus(503).withHeader(RETRY_AFTER, "1")));
IcecreamServiceApi client = builder().retryWhen(ReactiveRetryers.retry(3)).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
StepVerifier.create(client.findOrder(1)).expectErrorMatches(throwable -> throwable instanceof RetryPublisherHttpClient.OutOfRetriesException && hasProperty("cause", isA(RetryableException.class)).matches(throwable)).verify();
}
use of org.apache.http.HttpHeaders.RETRY_AFTER in project feign-reactive by kptfh.
the class RetryingTest method shouldFailAsNoMoreRetriesWithBackoff.
@Test
public void shouldFailAsNoMoreRetriesWithBackoff() {
String orderUrl = "/icecream/orders/1";
wireMockRule.stubFor(get(urlEqualTo(orderUrl)).withHeader("Accept", equalTo("application/json")).willReturn(aResponse().withStatus(503).withHeader(RETRY_AFTER, "1")));
IcecreamServiceApi client = builder().retryWhen(ReactiveRetryers.retryWithBackoff(7, 5)).target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port());
StepVerifier.create(client.findOrder(1)).expectErrorMatches(throwable -> throwable instanceof RetryPublisherHttpClient.OutOfRetriesException && hasProperty("cause", isA(RetryableException.class)).matches(throwable)).verify();
}
Aggregations