mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2026-06-13 16:59:13 +00:00
파일명 변경: event-이미지* → content-이미지*
변경 이유: - outer sequence 기준으로 이미지 생성은 Content Service 담당 - 파일명을 서비스 소유권에 맞게 변경 변경 파일: - event-이미지생성요청.puml → content-이미지생성요청.puml - event-이미지결과조회.puml → content-이미지결과조회.puml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
@startuml event-이미지생성요청
|
||||
!theme mono
|
||||
|
||||
title Content Service - 이미지 생성 요청 (UFR-CONT-010)
|
||||
|
||||
actor Client
|
||||
participant "API Gateway" as Gateway
|
||||
participant "ContentController" as Controller <<API Layer>>
|
||||
participant "ContentService" as Service <<Business Layer>>
|
||||
participant "JobManager" as JobMgr <<Component>>
|
||||
participant "Redis Cache" as Cache <<E>>
|
||||
|
||||
note over Controller, Cache
|
||||
**UFR-CONT-010: SNS 이미지 생성 요청**
|
||||
- Kafka 사용 안 함 (내부 Job 관리)
|
||||
- 백그라운드 워커가 비동기 처리
|
||||
- Redis에서 AI 추천 데이터 읽기
|
||||
- 3가지 스타일 이미지 생성 (심플, 화려한, 트렌디)
|
||||
end note
|
||||
|
||||
Client -> Gateway: POST /api/content/images/{eventDraftId}/generate
|
||||
activate Gateway
|
||||
|
||||
Gateway -> Controller: POST /api/content/images/{eventDraftId}/generate
|
||||
activate Controller
|
||||
|
||||
Controller -> Controller: 요청 검증\n(eventDraftId 유효성)
|
||||
|
||||
Controller -> Service: generateImages(eventDraftId)
|
||||
activate Service
|
||||
|
||||
== 1단계: Redis에서 AI 추천 데이터 확인 ==
|
||||
|
||||
Service -> Cache: AI 추천 데이터 조회\nKey: ai:event:{eventDraftId}
|
||||
activate Cache
|
||||
Cache --> Service: AI 추천 결과\n{선택된 추천안, 이벤트 정보}
|
||||
deactivate Cache
|
||||
|
||||
alt AI 추천 데이터 없음
|
||||
Service --> Controller: throw NotFoundException\n("AI 추천을 먼저 선택해주세요")
|
||||
Controller --> Gateway: 404 Not Found\n{"code": "CONTENT_001",\n"message": "AI 추천을 먼저 선택해주세요"}
|
||||
deactivate Service
|
||||
deactivate Controller
|
||||
Gateway --> Client: 404 Not Found
|
||||
deactivate Gateway
|
||||
|
||||
else AI 추천 데이터 존재
|
||||
|
||||
== 2단계: Job 생성 ==
|
||||
|
||||
Service -> JobMgr: createJob(eventDraftId, imageGeneration)
|
||||
activate JobMgr
|
||||
|
||||
JobMgr -> JobMgr: Job ID 생성 (UUID)
|
||||
|
||||
JobMgr -> Cache: Job 상태 저장\nKey: job:{jobId}\nValue: {status: PENDING,\neventDraftId, type: IMAGE_GEN,\ncreatedAt}\nTTL: 1시간
|
||||
activate Cache
|
||||
Cache --> JobMgr: 저장 완료
|
||||
deactivate Cache
|
||||
|
||||
JobMgr --> Service: Job 생성 완료\n{jobId, status: PENDING}
|
||||
deactivate JobMgr
|
||||
|
||||
== 3단계: 응답 반환 ==
|
||||
|
||||
Service --> Controller: JobResponse\n{jobId, status: PENDING}
|
||||
deactivate Service
|
||||
|
||||
Controller --> Gateway: 202 Accepted\n{"jobId": "job-uuid-123",\n"status": "PENDING",\n"message": "이미지 생성 중입니다"}
|
||||
deactivate Controller
|
||||
|
||||
Gateway --> Client: 202 Accepted\n이미지 생성 시작
|
||||
deactivate Gateway
|
||||
|
||||
note over Service, Cache
|
||||
**백그라운드 워커 처리**
|
||||
- Redis 폴링 또는 스케줄러가 Job 감지
|
||||
- content-이미지생성.puml 참조
|
||||
- 외부 이미지 생성 API 호출 (병렬)
|
||||
- Redis에 이미지 URL 저장
|
||||
|
||||
**상세 내용**
|
||||
- 3가지 스타일 병렬 생성 (심플, 화려한, 트렌디)
|
||||
- Circuit Breaker 적용 (Timeout: 5분)
|
||||
- 결과: Redis Key: content:image:{eventDraftId}
|
||||
- TTL: 7일
|
||||
end note
|
||||
end
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user