- 오늘 한 것
- 팀 프로젝트 (콘솔 호텔 예약 프로그램)
- 개인 프로젝트
팀 프로젝트
오늘부터 팀프로젝트로 콘솔 호텔 예약 프로그램을 구현하기로 했다.
일정과 역할 분담을 위해 우선 요구사항을 보며
게더타운에 칠판?에 팀원들과 같이 러프하게 구조를 잡아봤다.
역할 분담은 서비스별로 나눴고 내가 맡은 역할은 예약 취소 기능 구현이다.
내일 TIL에 구현 과정을 작성할 예정이다~
개인 프로젝트
WebClient request와 response 데이터 로깅 방법
외부 API 요청을 할 일이 생겨 restTemplate 대신 webClient를 써보았다.
API 응답을 잘 못받아와서 요청, 응답에 대한 데이터 확인을 위해 찾아보니
filter 체이닝을 하면서 로깅하는 방법들이 있던데, 좀 더 찾아보니 간단하게 구현하는 방법을 찾았다.
(.wiretap 부분)
HttpClient httpClient = HttpClient.create()
.wiretap(this.getClass().getCanonicalName(), LogLevel.DEBUG, AdvancedByteBufFormat.TEXTUAL);
ClientHttpConnector conn = new ReactorClientHttpConnector(httpClient);
WebClient client = WebClient.builder()
.clientConnector(conn)
.build();
아래는 출력 결과이다.
/api/nts-businessman/v1/status?serviceKey=xxxxxxx HTTP/1.1
user-agent: ReactorNetty/1.1.9
host: api.odcloud.kr
accept: */*
Content-Type: application/json
content-length: 23
{"b_no":["0000000000"]}
2023-10-24T21:05:30.604+09:00 DEBUG 80808 --- [ctor-http-nio-2] .l.c.c.i.WebClientConfig$$SpringCGLIB$$0 : FLUSH
2023-10-24T21:05:30.607+09:00 DEBUG 80808 --- [ctor-http-nio-2] .l.c.c.i.WebClientConfig$$SpringCGLIB$$0 : READ COMPLETE
2023-10-24T21:05:30.611+09:00 DEBUG 80808 --- [ctor-http-nio-2] .l.c.c.i.WebClientConfig$$SpringCGLIB$$0 : READ COMPLETE
2023-10-24T21:05:30.677+09:00 DEBUG 80808 --- [ctor-http-nio-2] .l.c.c.i.WebClientConfig$$SpringCGLIB$$0 : READ: 499B HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 298
Content-Type: application/json; charset=UTF-8
Date: Tue, 24 Oct 2023 12:05:30 GMT
Server: nginx/1.14.0 (Ubuntu)
Vary: Origin
{"request_cnt":1,"status_code":"OK","data":[{"b_no":"0000000000","b_stt":"","b_stt_cd":"","tax_type":"국세청에 등록되지 않은 사업자등록번호입니다.","tax_type_cd":"","end_dt":"","utcc_yn":"","tax_type_change_dt":"","invoice_apply_dt":"","rbf_tax_type":"","rbf_tax_type_cd":""}]}
728x90
'TIL' 카테고리의 다른 글
2023.10.27 TIL (1) | 2023.10.27 |
---|---|
2023.10.26 TIL (0) | 2023.10.26 |
2023.10.20 TIL (0) | 2023.10.20 |
2023.10.19 TIL (0) | 2023.10.19 |
2023.10.18 TIL (2) | 2023.10.19 |