avaje/avaje-http-client

Add RetryHandler with the option to define it on the HttpContext

rbygrave opened this issue · 0 comments

  static HttpClientContext initClientWithRetry() {
    return HttpClientContext.newBuilder()
      .withBaseUrl("http://localhost:8887")
      .withBodyAdapter(new JacksonBodyAdapter(new ObjectMapper()))
      .withRequestListener(new RequestLogger())
      .withRetryHandler(new SimpleRetryHandler(4, 1))
      .build();
  }

With SimpleRetryHandler constructed with max number of attempts and linear backoff in millis.