mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 20:46:24 +00:00
76 lines
2.6 KiB
Plaintext
76 lines
2.6 KiB
Plaintext
@startuml event-최종승인및배포
|
|
!theme mono
|
|
|
|
title Event Service - 최종 승인 및 Distribution Service 동기 호출 (UFR-EVENT-050)
|
|
|
|
participant "EventController" as Controller <<C>>
|
|
participant "EventService" as Service <<S>>
|
|
participant "EventRepository" as Repo <<R>>
|
|
participant "Redis Cache" as Cache <<E>>
|
|
database "Event DB" as DB <<E>>
|
|
participant "Distribution Service" as DistSvc <<E>>
|
|
participant "Kafka Producer" as Kafka <<E>>
|
|
|
|
note over Controller: POST /api/events/{id}/publish
|
|
Controller -> Service: publishEvent(eventDraftId, userId, selectedChannels)
|
|
activate Service
|
|
|
|
Service -> Repo: findById(eventDraftId)
|
|
activate Repo
|
|
Repo -> DB: SELECT * FROM event_drafts\nWHERE id = ? AND user_id = ?
|
|
activate DB
|
|
DB --> Repo: EventDraft
|
|
deactivate DB
|
|
Repo --> Service: EventDraft entity
|
|
deactivate Repo
|
|
|
|
Service -> Service: validateOwnership(userId, eventDraft)
|
|
Service -> Service: validatePublishReady()
|
|
note right: 발행 준비 검증:\n- 목적 선택 완료\n- AI 추천 선택 완료\n- 콘텐츠 선택 완료\n- 배포 채널 최소 1개
|
|
|
|
Service -> Repo: updateStatus(eventDraftId, APPROVED)
|
|
activate Repo
|
|
Repo -> DB: UPDATE event_drafts SET\nstatus = 'APPROVED',\napproved_at = NOW()\nWHERE id = ?
|
|
activate DB
|
|
DB --> Repo: OK
|
|
deactivate DB
|
|
Repo --> Service: EventDraft entity
|
|
deactivate Repo
|
|
|
|
Service -> Kafka: publish(EventCreated,\n{eventId, userId, title,\nobjective, createdAt})
|
|
activate Kafka
|
|
note right: Kafka Event Topic:\nevent-topic
|
|
Kafka --> Service: ACK
|
|
deactivate Kafka
|
|
|
|
Service -> DistSvc: POST /api/distribution/distribute\n{eventId, channels, content}
|
|
activate DistSvc
|
|
note right: 동기 호출 (Circuit Breaker 적용)\nTimeout: 70초
|
|
DistSvc -> DistSvc: distributeToChannels(eventId, channels)
|
|
note right: 다중 채널 병렬 배포:\n- 우리동네TV\n- 링고비즈\n- 지니TV\n- Instagram\n- Naver Blog\n- Kakao Channel
|
|
DistSvc --> Service: DistributionResponse\n{distributionId, channelResults}
|
|
deactivate DistSvc
|
|
|
|
Service -> Repo: updateStatus(eventDraftId, ACTIVE)
|
|
activate Repo
|
|
Repo -> DB: UPDATE event_drafts SET\nstatus = 'ACTIVE',\npublished_at = NOW()\nWHERE id = ?
|
|
activate DB
|
|
DB --> Repo: OK
|
|
deactivate DB
|
|
Repo --> Service: Event entity
|
|
deactivate Repo
|
|
|
|
Service -> Cache: delete("purpose:" + userId)
|
|
activate Cache
|
|
note right: 캐시 무효화
|
|
Cache --> Service: OK
|
|
deactivate Cache
|
|
|
|
Service --> Controller: PublishResponse\n{eventId, status: ACTIVE,\ndistributionResults}
|
|
deactivate Service
|
|
Controller --> Client: 200 OK\n{eventId, distributionResults}
|
|
|
|
note over Controller, Kafka: Distribution Service는\n배포 완료 후 Kafka에\nDistributionCompleted\n이벤트 발행
|
|
|
|
@enduml
|