refactor/24, 25 - 트랜잭션 아웃박스 패턴 적용 및 스케줄러 구현 - #32
Merged
Conversation
- StockCommandService 등 주요 도메인 로직에서 KafkaTemplate 직접 의존성 제거 - 트랜잭션 경계와 이벤트 발행을 분리하기 위한 InventoryOutbox 엔티티 및 Repository 구축 - InventoryOutboxHelper를 통한 비즈니스 로직과 이벤트 적재 트랜잭션 동기화 - 5초 주기 InventoryOutboxScheduler 구현 - JSON 직렬화/역직렬화 오류 방지를 위해 스케줄러 내 DTO 복원(deserializePayload?) 로직 적용
4 tasks
github-actions
Bot
requested review from
Jinyoung-Kim96,
Sehi55,
githyj-jang,
jihxonx and
qldo
May 13, 2026 01:33
|
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 직접 발행과 after‑commit 동기화를 제거하고, 도메인 이벤트를 트랜잭션 내부에서 DB outbox에 적재한 뒤 폴링 스케줄러가 Kafka로 릴레이하도록 리팩터링합니다. ChangesOutbox 패턴 도입 및 이벤트 릴레이
Sequence Diagram(s)sequenceDiagram
participant API as SchedulerTriggerController
participant Scheduler as InventoryOutboxScheduler
participant Repo as InventoryOutboxRepository
participant Helper as InventoryOutboxHelper
participant Kafka as KafkaTemplate
API->>Scheduler: processOutboxEvents() (manual trigger)
Scheduler->>Repo: findTop50ByStatusOrderByCreatedAtAsc(INIT)
Repo-->>Scheduler: pending outbox events
loop each outbox event
Scheduler->>Scheduler: deserializePayload(eventType, payload)
Scheduler->>Kafka: send(topic, dto) (async .whenComplete)
Kafka-->>Scheduler: send result (success/failure)
alt success
Scheduler->>Helper: markAsPublished(outboxId)
Helper->>Repo: save(status=PUBLISHED) [REQUIRES_NEW]
else failure
Scheduler->>Helper: handleFailure(outboxId)
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This was referenced May 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 작업 내용
🚀 주요 변경 사항
✅ 자체 체크리스트 (필수)
./gradlew build실행 결과 정상 (인증샷 첨부)📸 테스트 인증샷
💬 리뷰어 전달사항 (선택)
📎 참고 자료
Summary by CodeRabbit
새로운 기능
개선 사항
테스트
구성