diff --git a/receiver/src/main/java/com/myoa/engineering/crawl/ppomppu/receiver/infrastructure/client/ProcessorAPIWebClient.java b/receiver/src/main/java/com/myoa/engineering/crawl/ppomppu/receiver/infrastructure/client/ProcessorAPIWebClient.java index 986632c..87b763e 100644 --- a/receiver/src/main/java/com/myoa/engineering/crawl/ppomppu/receiver/infrastructure/client/ProcessorAPIWebClient.java +++ b/receiver/src/main/java/com/myoa/engineering/crawl/ppomppu/receiver/infrastructure/client/ProcessorAPIWebClient.java @@ -4,22 +4,23 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.core.ParameterizedTypeReference; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.reactive.function.client.WebClientRequestException; import com.myoa.engineering.crawl.ppomppu.support.dto.code.PpomppuBoardName; +import lombok.extern.slf4j.Slf4j; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; +@Slf4j @Component public class ProcessorAPIWebClient { - @Value("${webclient.base-url}") - private String baseUrl; - private final WebClient webClient; - public ProcessorAPIWebClient(WebClient.Builder webClientBuilder) { - this.webClient = webClientBuilder.baseUrl("http://localhost:20081") + public ProcessorAPIWebClient(WebClient.Builder webClientBuilder, + @Value("${webclient.base-url}") String baseUrl) { + this.webClient = webClientBuilder.baseUrl(baseUrl) .build(); } @@ -27,6 +28,10 @@ public class ProcessorAPIWebClient { return webClient.post() .uri("/api/v1/crawl/boards/{boardName}", boardName) .exchangeToMono(e -> e.bodyToMono(new ParameterizedTypeReference() {})) - .publishOn(Schedulers.boundedElastic()); + .publishOn(Schedulers.boundedElastic()) + .onErrorResume(WebClientRequestException.class, t -> { + log.info("Exception occured, ignoring. : {}", t.getClass().getSimpleName()); + return Mono.empty(); + }); } -} \ No newline at end of file +}