@startuml !theme mono title Distribution Service 클래스 다이어그램 (요약) package "com.kt.distribution" { package "controller" { class DistributionController <> } package "service" { class DistributionService <> class KafkaEventPublisher <> } package "adapter" { interface ChannelAdapter <> abstract class AbstractChannelAdapter <> class UriDongNeTvAdapter <> class RingoBizAdapter <> class GiniTvAdapter <> class InstagramAdapter <> class NaverAdapter <> class KakaoAdapter <> } package "dto" { class DistributionRequest <> class DistributionResponse <> class ChannelDistributionResult <> class DistributionStatusResponse <> class ChannelStatus <> enum ChannelType <> } package "repository" { class DistributionStatusRepository <> interface DistributionStatusJpaRepository <> } package "entity" { class DistributionStatus <> class ChannelStatusEntity <> } package "mapper" { class DistributionStatusMapper <> } package "event" { class DistributionCompletedEvent <> class DistributedChannelInfo <> } package "config" { class KafkaConfig <> class OpenApiConfig <> class WebConfig <> } } ' 주요 관계만 표시 DistributionController --> DistributionService DistributionService --> ChannelAdapter DistributionService --> KafkaEventPublisher DistributionService --> DistributionStatusRepository AbstractChannelAdapter ..|> ChannelAdapter UriDongNeTvAdapter --|> AbstractChannelAdapter RingoBizAdapter --|> AbstractChannelAdapter GiniTvAdapter --|> AbstractChannelAdapter InstagramAdapter --|> AbstractChannelAdapter NaverAdapter --|> AbstractChannelAdapter KakaoAdapter --|> AbstractChannelAdapter DistributionStatusRepository --> DistributionStatusJpaRepository DistributionStatusRepository --> DistributionStatusMapper DistributionStatusJpaRepository ..> DistributionStatus DistributionStatus "1" *-- "many" ChannelStatusEntity KafkaEventPublisher ..> DistributionCompletedEvent DistributionCompletedEvent --> DistributedChannelInfo note top of DistributionController **Controller 메소드 - API 매핑** distribute: POST /distribution/distribute - 다중 채널 배포 요청 getDistributionStatus: GET /distribution/{eventId}/status - 배포 상태 조회 end note note top of DistributionService **핵심 비즈니스 로직** • 다중 채널 병렬 배포 • ExecutorService 기반 비동기 처리 • 배포 상태 관리 (저장/조회) • Kafka 이벤트 발행 distribute(request) → 병렬 배포 실행 → 결과 집계 → 상태 저장 → 이벤트 발행 end note note top of AbstractChannelAdapter **Resilience4j 패턴 적용** • Circuit Breaker • Retry (지수 백오프) • Bulkhead (리소스 격리) • Fallback 처리 각 채널별 독립적 장애 격리 end note note top of DistributionStatusRepository **배포 상태 영구 저장** • PostgreSQL 저장 • JPA Repository 패턴 • Entity ↔ DTO 매핑 save(eventId, status) findByEventId(eventId) end note note right of ChannelType **배포 채널 종류** TV 채널: • URIDONGNETV (우리동네TV) • GINITV (지니TV) CALL 채널: • RINGOBIZ (링고비즈) SNS 채널: • INSTAGRAM • NAVER (Blog) • KAKAO (Channel) end note note bottom of DistributionStatus **배포 상태 엔티티** 전체 배포 상태 관리: • PENDING: 대기중 • IN_PROGRESS: 진행중 • COMPLETED: 완료 • PARTIAL_FAILURE: 부분성공 • FAILED: 실패 1:N 관계로 채널별 상태 관리 end note note bottom of KafkaEventPublisher **Kafka 이벤트 발행** Topic: distribution-completed 배포 완료 시 이벤트 발행 → Analytics Service 소비 end note @enduml