TO-BE
01. 아키텍처
Scheduler (ExpediaScheduler)
├─ runExpediaRegionsDaily()
├─ runExpediaPropertyContentDaily()
└─ runExpediaInactivePropertiesDaily()
↓
Service Layer
├─ ExpediaRegionsService
├─ ExpediaPropertyContentService
└─ ExpediaInactivePropertiesService
↓
API Layer (ExpediaRegionsApi, ExpediaPropertyContentsApi, ...)
↓
Converter Layer (ExpediaPropertyContentConverter)
↓
Merge Service Layer (ExpediaRegionsMergeService, ExpediaPropertyContentMergeService)
↓
Repository Layer
02 흐름도
graph TD
A[스케줄러 시작] --> B[ExpediaScheduler]
B --> C[ExpediaRegionsService]
C --> C1[BatchHistoryManager.startBatch]
C1 --> C2[국가 목록 조회]
C2 --> C3[Semaphore 20 설정]
C3 --> C4{국가별<br/>병렬 처리}
C4 -->|CompletableFuture| C5[국가 1<br/>Thread Pool]
C4 -->|CompletableFuture| C6[국가 2<br/>Thread Pool]
C4 -->|CompletableFuture| C7[국가 N<br/>Thread Pool]
C5 --> C8[페이징 콜백]
C6 --> C9[페이징 콜백]
C7 --> C10[페이징 콜백]
C8 --> C11[ExpediaRegionsApi]
C9 --> C11
C10 --> C11
C11 --> C12[ExpediaRegionsMergeService<br/>Bulk UPSERT]
C12 --> C13[ExpediaPropertyRegionMappingService<br/>Bulk UPSERT]
C13 --> C14[CompletableFuture.allOf]
C14 --> C15[BatchHistoryManager.finishBatch]
C15 --> C16[Slack 알림]
style C4 fill:#4ecdc4
style C5 fill:#95e1d3
style C6 fill:#95e1d3
style C7 fill:#95e1d3
style C12 fill:#44bd32
graph TD
A[스케줄러 시작] --> B[ExpediaScheduler]
B --> C[ExpediaPropertyContentService]
C --> C1[BatchHistoryManager.startBatch]
C1 --> C2[마지막 업데이트 날짜 조회]
C2 --> C3[국가 목록 조회]
C3 --> C4[Semaphore 2 설정]
C4 --> C5{국가별<br/>병렬 처리}
C5 -->|CompletableFuture| C6[국가 1<br/>Country Pool]
C5 -->|CompletableFuture| C7[국가 2<br/>Country Pool]
C6 --> C8[ExpediaRegionsService<br/>도시 정보 조회]
C7 --> C9[ExpediaRegionsService<br/>도시 정보 조회]
C8 --> C10[페이징 콜백]
C9 --> C11[페이징 콜백]
C10 --> C12[SupplierCityInfoService<br/>내부 도시 매핑]
C11 --> C12
C12 --> C13[GLOBAL_SEMAPHORE 20]
C13 --> C14{호텔별<br/>병렬 처리}
C14 -->|CompletableFuture| C15[호텔 1<br/>Worker Pool]
C14 -->|CompletableFuture| C16[호텔 2<br/>Worker Pool]
C14 -->|CompletableFuture| C17[호텔 N<br/>Worker Pool]
C15 --> C18[한국어 콘텐츠<br/>이미 조회됨]
C16 --> C19[한국어 콘텐츠<br/>이미 조회됨]
C17 --> C20[한국어 콘텐츠<br/>이미 조회됨]
C18 --> C21[ExpediaPropertyContentsApi<br/>영어 콘텐츠 조회]
C19 --> C21
C20 --> C21
C21 --> C22[ExpediaPropertyContentConverter<br/>데이터 변환]
C22 --> C23[ExpediaPropertyContentMergeService<br/>Bulk Merge]
C23 --> C24[CompletableFuture.allOf]
C24 --> C25[BatchHistoryManager.finishBatch]
C25 --> C26[Slack 알림]
style C5 fill:#4ecdc4
style C14 fill:#f6b93b
style C15 fill:#fad390
style C16 fill:#fad390
style C17 fill:#fad390
style C23 fill:#44bd32
graph TD
A[스케줄러 시작] --> B[ExpediaScheduler]
B --> C[ExpediaInactivePropertiesService]
C --> C1[BatchLoggerUtils.logBatchStart]
C1 --> C2[ExpediaInactivePropertiesApi<br/>현재일 -7일]
C2 --> C3[중복 제거<br/>Stream.distinct]
C3 --> C4[100개 단위 파티션]
C4 --> C5{파티션 Loop}
C5 --> C6[SupplierHotelInfoService<br/>updateSupplierHtlInfo]
C6 --> C7[UseYn = 'N' 업데이트]
C7 --> C5
C5 --> C8[BatchLoggerUtils.logBatchEnd]
C8 --> C9[Slack 알림]
style C3 fill:#e056fd
style C6 fill:#44bd32
02. 포인트
- 계층 분리
- Scheduler → Service → API → Converter → Merge → Repository
- 각 계층 명확한 책임 정의
- 도메인 분리
- 지역, 콘텐츠, 비활성화 배치 완전 분리
- 독립적인 실행 및 모니터링 가능
- 병렬 처리
- ReentrantLock 중복 스케쥴러 실행 방지
- CompletableFuture 기반 비동기 처리
- Semaphore 안전한 동시성 제어 및 리소스 과부하 방지