mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 18:06:23 +00:00
이미지 결과 조회 시퀀스 수정: Redis 캐시 제거하고 Event DB 직접 조회로 변경
This commit is contained in:
parent
ae23b27f58
commit
ff0cad6c57
@ -4,42 +4,50 @@
|
|||||||
title Event Service - 이미지 생성 결과 폴링 조회
|
title Event Service - 이미지 생성 결과 폴링 조회
|
||||||
|
|
||||||
participant "EventController" as Controller <<C>>
|
participant "EventController" as Controller <<C>>
|
||||||
participant "JobService" as JobSvc <<S>>
|
participant "EventService" as EventSvc <<S>>
|
||||||
participant "Redis Cache" as Cache <<E>>
|
participant "EventRepository" as EventRepo <<R>>
|
||||||
|
participant "Event DB" as EventDB <<D>>
|
||||||
|
|
||||||
note over Controller: GET /api/jobs/{jobId}/status
|
note over Controller: GET /api/events/{eventId}/status
|
||||||
Controller -> JobSvc: getJobStatus(jobId)
|
Controller -> EventSvc: 이미지 생성 결과 조회 요청\n(이벤트ID)
|
||||||
activate JobSvc
|
activate EventSvc
|
||||||
|
|
||||||
JobSvc -> Cache: get("job:" + jobId)
|
EventSvc -> EventRepo: 이벤트 조회\n(이벤트ID)
|
||||||
activate Cache
|
activate EventRepo
|
||||||
|
|
||||||
alt 캐시 히트
|
EventRepo -> EventDB: 이벤트 정보 조회
|
||||||
Cache --> JobSvc: Job data\n{status, result, createdAt}
|
activate EventDB
|
||||||
|
|
||||||
alt Job 완료 (status: COMPLETED)
|
alt 이벤트 존재
|
||||||
JobSvc --> Controller: JobStatusResponse\n{jobId, status: COMPLETED,\nimageUrls: {...}}
|
EventDB --> EventRepo: 이벤트 엔티티\n{이벤트ID, 상태, 이미지URL들,\n생성일시}
|
||||||
Controller --> Client: 200 OK\n{status: COMPLETED,\nimageUrls: {\n simple: "https://cdn.../simple.png",\n fancy: "https://cdn.../fancy.png",\n trendy: "https://cdn.../trendy.png"\n}}
|
deactivate EventDB
|
||||||
|
EventRepo --> EventSvc: Event 엔티티
|
||||||
|
|
||||||
else Job 진행중 (status: PROCESSING)
|
alt 이미지 생성 완료 (상태: COMPLETED)
|
||||||
JobSvc --> Controller: JobStatusResponse\n{jobId, status: PROCESSING,\nprogress: 33%}
|
EventSvc --> Controller: 완료 응답\n{이벤트ID, 상태: 완료,\n이미지URL들}
|
||||||
Controller --> Client: 200 OK\n{status: PROCESSING,\nprogress: 33%}
|
Controller --> Client: 200 OK\n{상태: 완료,\n이미지URL들: {\n 심플형: "https://cdn.../simple.png",\n 화려형: "https://cdn.../fancy.png",\n 트렌디형: "https://cdn.../trendy.png"\n}}
|
||||||
|
|
||||||
|
else 이미지 생성중 (상태: PROCESSING)
|
||||||
|
EventSvc --> Controller: 진행중 응답\n{이벤트ID, 상태: 처리중,\n진행률: 33%}
|
||||||
|
Controller --> Client: 200 OK\n{상태: 처리중,\n진행률: 33%}
|
||||||
note right: 클라이언트는 3초 후\n재요청
|
note right: 클라이언트는 3초 후\n재요청
|
||||||
|
|
||||||
else Job 실패 (status: FAILED)
|
else 이미지 생성 실패 (상태: FAILED)
|
||||||
JobSvc --> Controller: JobStatusResponse\n{jobId, status: FAILED, error}
|
EventSvc --> Controller: 실패 응답\n{이벤트ID, 상태: 실패,\n오류메시지}
|
||||||
Controller --> Client: 200 OK\n{status: FAILED, error}
|
Controller --> Client: 200 OK\n{상태: 실패,\n오류메시지}
|
||||||
end
|
end
|
||||||
|
|
||||||
else 캐시 미스
|
else 이벤트 미존재
|
||||||
Cache --> JobSvc: null
|
EventDB --> EventRepo: null
|
||||||
JobSvc --> Controller: NotFoundError
|
deactivate EventDB
|
||||||
Controller --> Client: 404 Not Found\n{error: "Job not found"}
|
EventRepo --> EventSvc: null
|
||||||
|
EventSvc --> Controller: 미발견 오류
|
||||||
|
Controller --> Client: 404 Not Found\n{오류: "이벤트를 찾을 수 없음"}
|
||||||
end
|
end
|
||||||
|
|
||||||
deactivate Cache
|
deactivate EventRepo
|
||||||
deactivate JobSvc
|
deactivate EventSvc
|
||||||
|
|
||||||
note over Controller, Cache: 최대 30초 동안 폴링\n(3초 간격, 최대 10회)\n\n타임아웃 시 클라이언트는\n에러 메시지 표시 및\n"다시 생성" 옵션 제공
|
note over Controller, EventDB: 최대 30초 동안 폴링\n(3초 간격, 최대 10회)\n\n타임아웃 시 클라이언트는\n에러 메시지 표시 및\n"다시 생성" 옵션 제공
|
||||||
|
|
||||||
@enduml
|
@enduml
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user