mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 18:46:23 +00:00
57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
@startuml event-AI추천요청
|
|
!theme mono
|
|
|
|
title Event Service - AI 추천 요청 (Kafka Job 발행) (UFR-EVENT-030)
|
|
|
|
participant "EventController" as Controller <<C>>
|
|
participant "EventService" as Service <<S>>
|
|
participant "JobService" as JobSvc <<S>>
|
|
participant "EventRepository" as Repo <<R>>
|
|
participant "Redis Cache" as Cache <<E>>
|
|
database "Event DB" as DB <<E>>
|
|
participant "Kafka Producer" as Kafka <<E>>
|
|
|
|
note over Controller: POST /api/events/{id}/ai-recommendations
|
|
Controller -> Service: requestAIRecommendation(eventDraftId, userId)
|
|
activate Service
|
|
|
|
Service -> Repo: findById(eventDraftId)
|
|
activate Repo
|
|
Repo -> DB: 이벤트 초안 조회\n(초안ID와 사용자ID로 조회)
|
|
activate DB
|
|
DB --> Repo: EventDraft
|
|
deactivate DB
|
|
Repo --> Service: EventDraft entity
|
|
deactivate Repo
|
|
|
|
Service -> Service: validateOwnership(userId, eventDraft)
|
|
note right: 사용자 권한 검증
|
|
|
|
Service -> JobSvc: createAIJob(eventDraft)
|
|
activate JobSvc
|
|
|
|
JobSvc -> JobSvc: generateJobId()
|
|
note right: UUID 생성
|
|
|
|
JobSvc -> Cache: set("job:" + jobId,\n{status: PENDING, createdAt}, TTL=1시간)
|
|
activate Cache
|
|
Cache --> JobSvc: OK
|
|
deactivate Cache
|
|
|
|
JobSvc -> Kafka: publish(ai-job,\n{jobId, eventDraftId, objective,\nindustry, region, storeInfo})
|
|
activate Kafka
|
|
note right: Kafka Job Topic:\nai-job-topic
|
|
Kafka --> JobSvc: ACK
|
|
deactivate Kafka
|
|
|
|
JobSvc --> Service: JobResponse\n{jobId, status: PENDING}
|
|
deactivate JobSvc
|
|
|
|
Service --> Controller: JobResponse\n{jobId, status: PENDING}
|
|
deactivate Service
|
|
Controller --> Client: 202 Accepted\n{jobId, status: PENDING}
|
|
|
|
note over Controller, Kafka: AI Service는 백그라운드에서\nKafka ai-job 토픽을 구독하여\n비동기로 처리
|
|
|
|
@enduml
|