mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 23:26:25 +00:00
변경 이유: - 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>
141 lines
4.2 KiB
Plaintext
141 lines
4.2 KiB
Plaintext
@startuml event-이미지결과조회
|
|
!theme mono
|
|
|
|
title Content Service - 이미지 생성 결과 폴링 조회
|
|
|
|
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
|
|
**폴링 방식 Job 상태 조회**
|
|
- 최대 30초 동안 폴링 (2초 간격)
|
|
- Job 상태: PENDING → PROCESSING → COMPLETED
|
|
- 이미지 URL: Redis에 저장 (TTL: 7일)
|
|
end note
|
|
|
|
Client -> Gateway: GET /api/content/jobs/{jobId}/status
|
|
activate Gateway
|
|
|
|
Gateway -> Controller: GET /api/content/jobs/{jobId}/status
|
|
activate Controller
|
|
|
|
Controller -> Service: getJobStatus(jobId)
|
|
activate Service
|
|
|
|
Service -> JobMgr: getJobStatus(jobId)
|
|
activate JobMgr
|
|
|
|
JobMgr -> Cache: Job 상태 조회\nKey: job:{jobId}
|
|
activate Cache
|
|
|
|
alt Job 데이터 존재
|
|
Cache --> JobMgr: Job 데이터\n{status, eventDraftId,\ntype, createdAt}
|
|
deactivate Cache
|
|
|
|
alt status = COMPLETED
|
|
JobMgr -> Cache: 이미지 URL 조회\nKey: content:image:{eventDraftId}
|
|
activate Cache
|
|
Cache --> JobMgr: 이미지 URL\n{simple, fancy, trendy}
|
|
deactivate Cache
|
|
|
|
JobMgr --> Service: JobStatusResponse\n{jobId, status: COMPLETED,\nimageUrls: {...}}
|
|
deactivate JobMgr
|
|
|
|
Service --> Controller: JobStatusResponse\n{status: COMPLETED, imageUrls}
|
|
deactivate Service
|
|
|
|
Controller --> Gateway: 200 OK\n{"status": "COMPLETED",\n"imageUrls": {\n "simple": "https://cdn.../simple.png",\n "fancy": "https://cdn.../fancy.png",\n "trendy": "https://cdn.../trendy.png"\n}}
|
|
deactivate Controller
|
|
|
|
Gateway --> Client: 200 OK\n이미지 URL 반환
|
|
deactivate Gateway
|
|
|
|
note right of Client
|
|
**프론트엔드 처리**
|
|
- 3가지 스타일 카드 표시
|
|
- 사용자가 스타일 선택
|
|
- 이미지 편집 가능
|
|
end note
|
|
|
|
else status = PROCESSING 또는 PENDING
|
|
JobMgr --> Service: JobStatusResponse\n{jobId, status: PROCESSING}
|
|
deactivate JobMgr
|
|
|
|
Service --> Controller: JobStatusResponse\n{status: PROCESSING}
|
|
deactivate Service
|
|
|
|
Controller --> Gateway: 200 OK\n{"status": "PROCESSING",\n"message": "이미지 생성 중입니다"}
|
|
deactivate Controller
|
|
|
|
Gateway --> Client: 200 OK\n진행 중 상태
|
|
deactivate Gateway
|
|
|
|
note right of Client
|
|
**폴링 재시도**
|
|
- 2초 후 재요청
|
|
- 최대 30초 (15회)
|
|
end note
|
|
|
|
else status = FAILED
|
|
JobMgr -> Cache: 에러 정보 조회\nKey: job:{jobId}:error
|
|
activate Cache
|
|
Cache --> JobMgr: 에러 메시지
|
|
deactivate Cache
|
|
|
|
JobMgr --> Service: JobStatusResponse\n{jobId, status: FAILED, error}
|
|
deactivate JobMgr
|
|
|
|
Service --> Controller: JobStatusResponse\n{status: FAILED, error}
|
|
deactivate Service
|
|
|
|
Controller --> Gateway: 200 OK\n{"status": "FAILED",\n"error": "이미지 생성 실패",\n"message": "다시 시도해주세요"}
|
|
deactivate Controller
|
|
|
|
Gateway --> Client: 200 OK\n실패 상태
|
|
deactivate Gateway
|
|
|
|
note right of Client
|
|
**실패 처리**
|
|
- 에러 메시지 표시
|
|
- "다시 생성" 버튼 제공
|
|
end note
|
|
end
|
|
|
|
else Job 데이터 없음
|
|
Cache --> JobMgr: null (캐시 미스)
|
|
deactivate Cache
|
|
|
|
JobMgr --> Service: throw NotFoundException\n("Job을 찾을 수 없습니다")
|
|
deactivate JobMgr
|
|
|
|
Service --> Controller: NotFoundException
|
|
deactivate Service
|
|
|
|
Controller --> Gateway: 404 Not Found\n{"code": "JOB_001",\n"message": "Job을 찾을 수 없습니다"}
|
|
deactivate Controller
|
|
|
|
Gateway --> Client: 404 Not Found
|
|
deactivate Gateway
|
|
end
|
|
|
|
note over Controller, Cache
|
|
**폴링 전략**
|
|
- 간격: 2초
|
|
- 최대 시간: 30초 (15회)
|
|
- Timeout 시: 사용자에게 알림 + "다시 생성" 옵션
|
|
|
|
**Redis 캐시**
|
|
- Job 상태: TTL 1시간
|
|
- 이미지 URL: TTL 7일
|
|
|
|
**성능 목표**
|
|
- 평균 이미지 생성 시간: 20초 이내
|
|
- P95 이미지 생성 시간: 40초 이내
|
|
end note
|
|
|
|
@enduml
|