목차

Spring HTTP Client Interface

retry

 @Bean
  TodoClient todoClient() {
    WebClient webClient =
        WebClient.builder()
            .baseUrl("sampleUrl")
            .filter(retryFilter())
            .build();
    HttpServiceProxyFactory factory =
        HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build();
    return factory.createClient(TodoClient.class);
  }
 
 
private ExchangeFilterFunction retryFilter() {
     return (request, next) ->
         next.exchange(request)
             .retryWhen(
                         Retry.fixedDelay(3, Duration.ofSeconds(30))
             .doAfterRetry(retrySignal -> log.warn("Retrying"));
      };
  }

참조