kt-event-marketing/design/backend/sequence/inner/event-목적선택.puml
2025-10-22 14:13:57 +09:00

52 lines
1.6 KiB
Plaintext

@startuml event-목적선택
!theme mono
title Event Service - 이벤트 목적 선택 및 저장 (UFR-EVENT-020)
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 "Kafka Producer" as Kafka <<E>>
note over Controller: POST /api/events/purposes
Controller -> Service: createEventDraft(userId, objective, storeInfo)
activate Service
Service -> Cache: get("purpose:" + userId)
activate Cache
Cache --> Service: null (캐시 미스)
deactivate Cache
Service -> Service: validate(objective, storeInfo)
note right: 목적 유효성 검증\n- 신규 고객 유치\n- 재방문 유도\n- 매출 증대\n- 인지도 향상
Service -> Repo: save(eventDraft)
activate Repo
Repo -> DB: INSERT INTO event_drafts\n(user_id, objective, store_info, status)
activate DB
DB --> Repo: eventDraftId
deactivate DB
Repo --> Service: EventDraft entity
deactivate Repo
Service -> Cache: set("purpose:" + userId, eventDraft, TTL=30분)
activate Cache
Cache --> Service: OK
deactivate Cache
Service -> Kafka: publish(EventCreated,\n{eventDraftId, userId, objective, createdAt})
activate Kafka
note right: Kafka Event Topic:\nevent-topic
Kafka --> Service: ACK
deactivate Kafka
Service --> Controller: EventDraftResponse\n{eventDraftId, objective, status}
deactivate Service
Controller --> Client: 200 OK\n{eventDraftId}
note over Controller, Kafka: 캐시 히트 시:\n1. Redis에서 조회 → 즉시 반환\n2. DB 조회 생략
@enduml