hgzero/design/backend/sequence/inner/notification-Todo알림발송.puml
kimjh 909025aa27 내부 시퀀스 설계 완료
- 총 21개 PlantUML 파일 생성 (Meeting 10개, AI 6개, STT 2개, Notification 3개)
- 서브 에이전트를 활용한 병렬 설계로 효율성 극대화
- 모든 시나리오는 유저스토리 및 외부 시퀀스와 1:1 매칭
- Controller → Service → Repository 계층 구조 명확히 표현
- Redis Cache, Azure Event Hubs 등 인프라 컴포넌트 표시
- 동기(→)/비동기(-->) 구분 명확
- 외부 참여자 <<E>> 표시 적용
- PlantUML 문법 검사 및 오류 수정 완료 (13개 파일 수정)
- par/and 블록 문법 오류 수정
- return 형식 적용으로 참여자 없는 화살표 오류 해결

설계 특징:
- 캐시 전략: Cache-Aside 패턴, TTL 관리, 즉시 무효화
- 비동기 처리: Azure Event Hubs 기반 이벤트 구독
- 실시간 협업: WebSocket 기반 동기화, 변경 델타 전송
- 데이터 일관성: 버전 관리, 양방향 연결, 트랜잭션 처리

추가 파일:
- claude/sequence-inner-design.md: 내부시퀀스설계 가이드
- tools/check-plantuml.ps1: PlantUML 문법 검사 스크립트

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 15:59:13 +09:00

148 lines
3.9 KiB
Plaintext

@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<<E>>" as EventHub
participant "Email Service<<E>>" 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: INSERT INTO notifications\n(notification_id, todo_id,\ntype='TODO_ASSIGNED',\nstatus='PENDING',\nrecipients,\ncreated_at)
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: UPDATE notifications\nSET status='SENT',\nsent_at=NOW()\nWHERE notification_id='{notificationId}'
activate DB
DB --> Repository: 업데이트 완료
deactivate DB
Repository --> Service: 완료
deactivate Repository
else 발송 실패
EmailClient --> Service: FAILED (errorMessage)
Service -> Repository: updateNotificationStatus(notificationId, "FAILED")
activate Repository
Repository -> DB: UPDATE notifications\nSET status='FAILED',\nerror_message='{errorMessage}'\nWHERE notification_id='{notificationId}'
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