feat/36 - fix: 주문 생성 부분도 비동기로 변경 - #37
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughKafka의 주문 생성 메시지를 받아 OrderEventConsumer → StockLockFacade(정렬 기반 멀티락) → StockCommandService(트랜잭션 재고 차감, 멱등성 검사) 흐름으로 처리하고 결과를 Outbox의 ORDER_APPROVED/ORDER_REJECTED로 적재합니다. Changes주문 생성 비동기 처리 및 다중 재고 차감 흐름
Sequence DiagramsequenceDiagram
participant Kafka as Kafka (order-created)
participant Consumer as OrderEventConsumer
participant Lock as StockLockFacade
participant Command as StockCommandService
participant Repo as StockRepository
participant Outbox as InventoryOutbox
Kafka->>Consumer: OrderCreatedMessage
Consumer->>Lock: reserveOrderStocksWithLock(msg)
Lock->>Lock: 정렬된 optionId 리스트 생성
Lock->>Lock: sequential tryLock(stock:{optionId}, 5s)
Lock->>Command: processOrderCreation(msg)
Command->>Repo: 멱등성 검사(ProcessedEvent)
Command->>Repo: Stock.reserve(optionId, qty)
alt 품절 발생
Command->>Repo: Product.status = SOLDOUT
Command->>Outbox: append(PRODUCT_STATUS_CHANGED)
end
Command->>Repo: saveAll(Stocks)
Command->>Repo: save(ProcessedEvent)
alt 전체 성공
Command->>Outbox: append(ORDER_APPROVED)
else 비즈니스 실패
Command-->>Consumer: BusinessException
Consumer->>Outbox: appendIndependent(ORDER_REJECTED)
end
Lock->>Lock: finally: 역순 unlock
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 작업 내용
🚀 주요 변경 사항
✅ 자체 체크리스트 (필수)
./gradlew build실행 결과 정상 (인증샷 첨부)📸 테스트 인증샷
💬 리뷰어 전달사항 (선택)
📎 참고 자료
Summary by CodeRabbit
New Features
Refactor
Style/Validation