mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 15:26:23 +00:00
46 lines
1.6 KiB
Plaintext
46 lines
1.6 KiB
Plaintext
@startuml event-추천결과조회
|
|
!theme mono
|
|
|
|
title Event Service - AI 추천 결과 폴링 조회
|
|
|
|
participant "EventController" as Controller <<C>>
|
|
participant "JobService" as JobSvc <<S>>
|
|
participant "Redis Cache" as Cache <<E>>
|
|
|
|
note over Controller: GET /api/jobs/{jobId}/status
|
|
Controller -> JobSvc: getJobStatus(jobId)
|
|
activate JobSvc
|
|
|
|
JobSvc -> Cache: get("job:" + jobId)
|
|
activate Cache
|
|
|
|
alt 캐시 히트
|
|
Cache --> JobSvc: Job data\n{status, result, createdAt}
|
|
|
|
alt Job 완료 (status: COMPLETED)
|
|
JobSvc --> Controller: JobStatusResponse\n{jobId, status: COMPLETED,\nrecommendations: [...]}
|
|
Controller --> Client: 200 OK\n{status: COMPLETED,\nrecommendations: [\n {title, prize, method, cost, roi},\n {title, prize, method, cost, roi},\n {title, prize, method, cost, roi}\n]}
|
|
|
|
else Job 진행중 (status: PROCESSING)
|
|
JobSvc --> Controller: JobStatusResponse\n{jobId, status: PROCESSING}
|
|
Controller --> Client: 200 OK\n{status: PROCESSING}
|
|
note right: 클라이언트는 2초 후\n재요청
|
|
|
|
else Job 실패 (status: FAILED)
|
|
JobSvc --> Controller: JobStatusResponse\n{jobId, status: FAILED, error}
|
|
Controller --> Client: 200 OK\n{status: FAILED, error}
|
|
end
|
|
|
|
else 캐시 미스
|
|
Cache --> JobSvc: null
|
|
JobSvc --> Controller: NotFoundError
|
|
Controller --> Client: 404 Not Found\n{error: "Job not found"}
|
|
end
|
|
|
|
deactivate Cache
|
|
deactivate JobSvc
|
|
|
|
note over Controller, Cache: 최대 30초 동안 폴링\n(2초 간격, 최대 15회)\n\n타임아웃 시 클라이언트는\n에러 메시지 표시
|
|
|
|
@enduml
|