From ff0cad6c570d415395da506e523472bc43367093 Mon Sep 17 00:00:00 2001 From: doyeon Date: Thu, 23 Oct 2025 10:25:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=ED=80=80=EC=8A=A4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95:=20Redis=20=EC=BA=90=EC=8B=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=ED=95=98=EA=B3=A0=20Event=20DB=20=EC=A7=81=EC=A0=91?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sequence/inner/event-이미지결과조회.puml | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/design/backend/sequence/inner/event-이미지결과조회.puml b/design/backend/sequence/inner/event-이미지결과조회.puml index 31fa7d2..2f996fc 100644 --- a/design/backend/sequence/inner/event-이미지결과조회.puml +++ b/design/backend/sequence/inner/event-이미지결과조회.puml @@ -4,42 +4,50 @@ title Event Service - 이미지 생성 결과 폴링 조회 participant "EventController" as Controller <> -participant "JobService" as JobSvc <> -participant "Redis Cache" as Cache <> +participant "EventService" as EventSvc <> +participant "EventRepository" as EventRepo <> +participant "Event DB" as EventDB <> -note over Controller: GET /api/jobs/{jobId}/status -Controller -> JobSvc: getJobStatus(jobId) -activate JobSvc +note over Controller: GET /api/events/{eventId}/status +Controller -> EventSvc: 이미지 생성 결과 조회 요청\n(이벤트ID) +activate EventSvc -JobSvc -> Cache: get("job:" + jobId) -activate Cache +EventSvc -> EventRepo: 이벤트 조회\n(이벤트ID) +activate EventRepo -alt 캐시 히트 - Cache --> JobSvc: Job data\n{status, result, createdAt} +EventRepo -> EventDB: 이벤트 정보 조회 +activate EventDB - alt Job 완료 (status: COMPLETED) - JobSvc --> Controller: JobStatusResponse\n{jobId, status: COMPLETED,\nimageUrls: {...}} - 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}} +alt 이벤트 존재 + EventDB --> EventRepo: 이벤트 엔티티\n{이벤트ID, 상태, 이미지URL들,\n생성일시} + deactivate EventDB + EventRepo --> EventSvc: Event 엔티티 - else Job 진행중 (status: PROCESSING) - JobSvc --> Controller: JobStatusResponse\n{jobId, status: PROCESSING,\nprogress: 33%} - Controller --> Client: 200 OK\n{status: PROCESSING,\nprogress: 33%} + alt 이미지 생성 완료 (상태: COMPLETED) + EventSvc --> Controller: 완료 응답\n{이벤트ID, 상태: 완료,\n이미지URL들} + 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재요청 - else Job 실패 (status: FAILED) - JobSvc --> Controller: JobStatusResponse\n{jobId, status: FAILED, error} - Controller --> Client: 200 OK\n{status: FAILED, error} + else 이미지 생성 실패 (상태: FAILED) + EventSvc --> Controller: 실패 응답\n{이벤트ID, 상태: 실패,\n오류메시지} + Controller --> Client: 200 OK\n{상태: 실패,\n오류메시지} end -else 캐시 미스 - Cache --> JobSvc: null - JobSvc --> Controller: NotFoundError - Controller --> Client: 404 Not Found\n{error: "Job not found"} +else 이벤트 미존재 + EventDB --> EventRepo: null + deactivate EventDB + EventRepo --> EventSvc: null + EventSvc --> Controller: 미발견 오류 + Controller --> Client: 404 Not Found\n{오류: "이벤트를 찾을 수 없음"} end -deactivate Cache -deactivate JobSvc +deactivate EventRepo +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