graph TB %% KT AI 기반 소상공인 이벤트 자동 생성 서비스 - 논리 아키텍처 (CQRS + Event-Driven) %% Command Services (Write) subgraph "Command Services" UserCmd["User Service
• 회원가입/로그인
• 프로필 관리
• 사업자번호 검증"] EventCmd["Event Command
Service
• 이벤트 생성/수정/삭제
• 플로우 오케스트레이션"] PartCmd["Participation
Command Service
• 참여 접수
• 당첨자 추첨"] end %% Query Services (Read) subgraph "Query Services" EventQuery["Event Query
Service
• 이벤트 목록/상세
• 이벤트 검색"] PartQuery["Participation
Query Service
• 참여자 목록
• 당첨자 조회"] AnalQuery["Analytics Query
Service
• 실시간 대시보드
• 성과 분석"] end %% Async Services subgraph "Async Services" AISvc["AI Service
• 트렌드 분석
• 이벤트 추천
[Circuit Breaker]"] ContentSvc["Content Service
• SNS 이미지 생성
• 3가지 스타일
[Circuit Breaker]"] DistSvc["Distribution
Service
• 다중 채널 배포
[Circuit Breaker]
[Retry Pattern]"] end %% Event Bus EventBus["Event Bus
(Kafka/SQS)
━━━━━━━━━━
• EventCreated
• EventPublished
• ParticipantRegistered
• WinnerSelected
• DistributionCompleted"] %% Job Queue JobQueue["Job Queue
(RabbitMQ)
━━━━━━━━━━
• AI 작업 큐
• 이미지 생성 큐"] %% External System External["외부시스템
[Circuit Breaker]
━━━━━━━━━━
• 국세청 API
• AI API
• 이미지 생성 API
• 배포 채널 APIs"] %% Command to Event Bus (이벤트 발행) EventCmd ==>|"1. EventCreated
발행"| EventBus EventCmd ==>|"2. EventPublished
발행"| EventBus PartCmd ==>|"3. ParticipantRegistered
발행"| EventBus PartCmd ==>|"4. WinnerSelected
발행"| EventBus DistSvc ==>|"5. DistributionCompleted
발행"| EventBus %% Event Bus to Services (이벤트 구독) EventBus -.->|"EventCreated
구독"| EventQuery EventBus -.->|"EventCreated
구독"| AnalQuery EventBus -.->|"EventPublished
구독"| DistSvc EventBus -.->|"ParticipantRegistered
구독"| PartQuery EventBus -.->|"ParticipantRegistered
구독"| AnalQuery EventBus -.->|"WinnerSelected
구독"| PartQuery EventBus -.->|"DistributionCompleted
구독"| AnalQuery %% Command to Job Queue (비동기 작업) EventCmd -->|"AI 추천 요청"| JobQueue EventCmd -->|"이미지 생성 요청"| JobQueue JobQueue -->|작업 처리| AISvc JobQueue -->|작업 처리| ContentSvc %% Query to Query (읽기 최적화) AnalQuery -.->|캐시 조회| EventQuery AnalQuery -.->|캐시 조회| PartQuery %% Services to External (Resilience 패턴) UserCmd -->|"사업자번호 검증
[Circuit Breaker]
[Retry: 3회]"| External AISvc -->|"트렌드 분석/추천
[Circuit Breaker]
[Timeout: 30s]"| External ContentSvc -->|"이미지 생성
[Circuit Breaker]
[Timeout: 20s]"| External DistSvc -->|"다중 채널 배포
[Circuit Breaker]
[Retry: 3회]
[Bulkhead]"| External AnalQuery -->|"채널별 통계
[Circuit Breaker]
[Fallback: Cache]"| External %% Styling classDef command fill:#4ECDC4,stroke:#14B8A6,stroke-width:3px classDef query fill:#10B981,stroke:#059669,stroke-width:3px classDef async fill:#8B5CF6,stroke:#7C3AED,stroke-width:3px,color:#fff classDef eventbus fill:#F59E0B,stroke:#D97706,stroke-width:3px classDef jobqueue fill:#FB923C,stroke:#EA580C,stroke-width:3px classDef external fill:#E5E7EB,stroke:#9CA3AF,stroke-width:2px class UserCmd,EventCmd,PartCmd command class EventQuery,PartQuery,AnalQuery query class AISvc,ContentSvc,DistSvc async class EventBus eventbus class JobQueue jobqueue class External external