사용자 도구

사이트 도구


springframework:http_interface

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"));
      };
  }

참조

springframework/http_interface.txt · 마지막으로 수정됨: 2023/09/13 12:58 저자 kwon37xi