본문 바로가기

전체글139

WebClient 사용할때 주의 (5편) Metric 먼저 Webclient 레벨에서 보내는 metric과 내부 구현체인 reactor.netty 레벨에서 보내는 metric 은 서로 다르다. WebClient 레벨에서 보내는 metric은 DefaultWebClientExchangeTagsProvider 에서 설정해서 보내고 있으며, uri template 단위로 태그 하고 있다. public class DefaultWebClientExchangeTagsProvider implements WebClientExchangeTagsProvider { @Override public Iterable tags(ClientRequest request, ClientResponse response, Throwable throwable) { Tag method.. 2021. 11. 11.
[구현] 게임 개발 N x M 크기의 2차원 배열에서 규칙에 따라 캐릭터를 이동시키고, 캐릭터가 방문한 칸의 수를 출력한다(3 2021. 11. 8.
WebClient 사용할때 주의 (4편) 이전 WebClient 글 예제 코드로 아래와 같이 clientResponse.createException().flatMap() 과 onErrorResume 을 사용했는데 flatMap 을 해서 다시 Mono.error 로 감싸는, 어떻게 보면 비효율적인 코드다. AS-IS .retrieve() .onStatus( httpStatus -> httpStatus != HttpStatus.OK, clientResponse -> { return clientResponse.createException() .flatMap(it -> Mono.error(new RuntimeException("code : " + clientResponse.statusCode()))); }) .bodyToMono(String.class.. 2021. 11. 5.
The dark side of distributed systems 분산 시스템은, 존재조차 모르는 서버 오류로 인해 내 서버를 사용할 수 없는 위험성이 있다. 실패(failures)는 피할 수 없다. 원문에서는 failures 라고 되어 있는데 에러로 인한 장애를 피할 수 없다는 말로 이해했다. 분산 시스템이 클수록 이런 역동성(dynamism) 이 커지고 장애가 날 가능성이 높아진다. 쿠버네티스 월드에서 분산 컴퓨팅에 대한 잘못된 생각(많은 사람들이 옳다고 믿는) 8가지가 있다. 1. The network is reliable 2. Latency is zero 3. Bandwidth is infinite 4. The network is secure 5. Topology doesn’t change 6. There is one administrator 7. Transpo.. 2021. 11. 4.
[구현] 왕실의 나이트 나이트 위치를 입력을 받았을 때 이동할 수 있는 경우의 수를 출력해보자. def convert(alphabet): if alphabet == 'a': return 1 if alphabet == 'b': return 2 if alphabet == 'c': return 3 if alphabet == 'd': return 4 if alphabet == 'e': return 5 if alphabet == 'f': return 6 if alphabet == 'g': return 7 if alphabet == 'h': return 8 s = input() x = convert(s[0]) y = int(s[1]) dx = [-2, -2, 2, 2, -1, -1, 1, 1] dy = [1, -1, 1, -1, 2, -.. 2021. 10. 31.
여러 API 결과 조합(with 비동기) 최종 결과 데이터를 만들기 위해 여러 API 들을 호출하고, 얻어온 각 API 결과들을 조합하는 로직을 만든다고 해보자. 먼저 아래코드처럼 각 API 결과들을 순차적으로 가져와 조합하는 방법이 있다. @Service public class SimpleContext { @Autowired private FirstJobService firstJobService; @Autowired private SecondJobService secondJobService; @Autowired private ThirdJobService thirdJobService; @Autowired private FourthJobService fourthJobService; public CombineContextResult combine(.. 2021. 10. 31.