@startuml !theme mono title Notification Service - Todo알림발송 내부 시퀀스 participant "NotificationController" as Controller participant "NotificationService" as Service participant "EmailTemplateService" as TemplateService participant "NotificationRepository" as Repository participant "EmailClient" as EmailClient database "Notification DB" as DB queue "Azure Event Hubs<>" as EventHub participant "Email Service<>" as EmailService == TodoAssigned 이벤트 수신 == EventHub -> Controller: TodoAssigned 이벤트 수신 activate Controller note right 이벤트 데이터: - todoId - meetingId - 담당자 (userId, userName, email) - Todo 내용 - 마감일 - 우선순위 - 회의록 링크 end note Controller -> Service: sendTodoNotification(todoId, todoData) activate Service == 알림 기록 생성 == Service -> Repository: createNotification(todoId, "TODO_ASSIGNED", assignee) activate Repository Repository -> DB: 알림 정보 생성\n(알림ID, TodoID, 유형, 상태, 수신자, 생성일시) activate DB DB --> Repository: notificationId 반환 deactivate DB Repository --> Service: NotificationEntity 반환 deactivate Repository == 이메일 템플릿 생성 == Service -> TemplateService: generateTodoEmail(todoData) activate TemplateService TemplateService -> TemplateService: 템플릿 로드 note right 템플릿 정보: - 제목: "[TODO 할당] {Todo 내용}" - 내용: Todo 상세 + 회의록 링크 - 우선순위 뱃지 표시 end note TemplateService -> TemplateService: 데이터 바인딩 note right 바인딩 데이터: - Todo 내용 - 마감일 - 우선순위 - 회의 제목 - 회의록 링크 (해당 섹션) - Todo 관리 페이지 링크 end note TemplateService --> Service: EmailContent 반환 deactivate TemplateService == 이메일 발송 == Service -> EmailClient: sendEmail(assignee.email, emailContent) activate EmailClient EmailClient -> EmailService: SMTP 이메일 발송 activate EmailService EmailService --> EmailClient: 발송 결과 deactivate EmailService alt 발송 성공 EmailClient --> Service: SUCCESS Service -> Repository: updateNotificationStatus(notificationId, "SENT") activate Repository Repository -> DB: 알림 상태 업데이트\n(상태=발송완료, 발송일시=현재시각) activate DB DB --> Repository: 업데이트 완료 deactivate DB Repository --> Service: 완료 deactivate Repository else 발송 실패 EmailClient --> Service: FAILED (errorMessage) Service -> Repository: updateNotificationStatus(notificationId, "FAILED") activate Repository Repository -> DB: 알림 상태 업데이트\n(상태=발송실패, 오류메시지=에러내용) activate DB DB --> Repository: 업데이트 완료 deactivate DB Repository --> Service: 완료 deactivate Repository Service -> Service: 재시도 큐에 추가 end deactivate EmailClient Service --> Controller: NotificationResponse\n(notificationId, status) deactivate Service Controller --> EventHub: TodoNotificationSent 이벤트 발행\n(todoId, notificationId, status) deactivate Controller == Todo 마감일 3일 전 리마인더 (스케줄링) == note over Service, EmailService 별도 스케줄링 작업: - 마감일 3일 전 자동 리마인더 - 실행 주기: 1일 1회 - 대상: 미완료 Todo - 템플릿: "[리마인더] Todo 마감 3일 전" end note note over Controller, EmailService 처리 시간: - 알림 기록 생성: ~100ms - 템플릿 생성: ~200ms - 이메일 발송: ~500ms - 총 처리 시간: ~800ms 재시도 정책: - 최대 3회 재시도 - 재시도 간격: 5분, 15분, 30분 Todo 알림 유형: 1. 할당 알림 (즉시) 2. 마감일 3일 전 리마인더 3. 마감일 1일 전 리마인더 4. 마감일 당일 리마인더 end note @enduml