composition:notification-platform — 알림 capability
- Module ID:
composition-notification-platform - Gradle path:
:composition:notification-platform - Package:
dev.caskeleton.composition.notification - 테스트:
./gradlew :composition:notification-platform:test --console=plain
제공하는 것
이 모듈 하나를 붙이면 알림 기능 전체가 들어온다.
composition:notification-platform
├─ NotificationApplicationCompositionAutoConfiguration (use case 조립, `enabled` 조건)
│ ├─ NotificationSubmissionConfiguration 접수·예약·취소·조회·템플릿 발행 use case
│ ├─ NotificationDeliveryConfiguration 발송·재조정·lease 회수·ledger 투영 서비스
│ ├─ NotificationAdminConfiguration 운영자 use case 넷(redrive·reconcile·suppress·provider 상태)
│ ├─ NotificationCallbackConfiguration provider 콜백 수집 + ProviderCallbackIngressBridge
│ └─ NotificationWorkerConfiguration (SERVING만) 발송 scheduler와 회복·replay·맞추기 worker
├─ config/module-defaults/notification.yml (설정 기본값, support 로더가 읽음)
├─ adapter:outbound:notification provider(SMTP·SES), 저장 외 런타임, NotificationPlatformAutoConfiguration
├─ adapter:outbound:persistence-notification (runtimeOnly) 알림 entity·저장소·Flyway stream
├─ adapter:outbound:persistence-jpa (runtimeOnly) DataSource·Flyway core·TransactionPort
└─ adapter:inbound:web-notification POST /notifications, POST /notificationTemplates,
POST /internal/notification/callbacks/{provider}/{profile}
- 조립 순서: 이 모듈의 root는
NotificationPlatformAutoConfiguration(outbound leaf) 뒤에 온다 (afterName). - worker: 두 worker(
NotificationSchedulerWorker,NotificationBackgroundWorkers)는 스레드와 일정만 가진다. 하는 일은@SystemInvokeduse case(claim·발송·lease 회복·provider event replay·맞추기)와 backlog 측정 query use case이고, worker 설정이new로 만들어 넘긴다. bean이 아니어서 어떤 전송도 닿지 못한다(manual 07 「시스템이 부르는 쓰기」).mode=INGEST_ONLY면 worker 설정 자체가 실리지 않는다. - 설정:
config/module-defaults/notification.yml을 support의ModuleDefaultsEnvironmentPostProcessor가 읽는다. 우선순위는 가장 낮다. 그래서application*.yml, 환경 변수, 시스템 속성이 항상 이긴다. app-bootstrap은 이 파일을 모른다. - 저장소: 요청·발송·ledger 테이블과 migration은
adapter:outbound:persistence-notification에 있고, 그 테이블이 사는 관계형 플랫폼(DataSource, Flyway core stream, capability schema registry,TransactionPort)은adapter:outbound:persistence-jpa다. 이 모듈이 둘 다runtimeOnly로 가져오므로 (fileserver와 같은 한 줄 원칙) 따로 넣을 줄은 없다.APP_PERSISTENCE_JPA_ENABLED=false로 끄면 안 된다.
추가할 한 줄
// src/bootstrap/app/build.gradle
runtimeOnly project(':composition:notification-platform') // 알림 (저장소·JPA 플랫폼 포함)
기본 조립에는 없다(src/bootstrap/app/build.gradle에 주석 처리된 줄로 있다). 이 줄을 지우면 use case
조립, provider 어댑터, HTTP 엔드포인트, 설정 기본값이 모두 함께 빠진다.
켜기와 끄기
모듈이 있으면 켜진다. app.notification.platform.enabled(APP_NOTIFICATION_PLATFORM_ENABLED,
기본 true)를 false로 줄 때만 꺼지고, 그때는 아무것도 바인딩하지 않는다. 켜진 상태에서는 아래
"항상" 키가 없으면 기동이 거부된다.
필요한 env 키
전체 목록과 타입·기본값은 docs/registries/env-keys.yaml의 APP_NOTIFICATION_*,
SPRING_MAIL_* 행이 SSOT다. 켤 때 실제로 넣어야 하는 것:
| 언제 | 키 |
|---|---|
| 항상 | 데이터베이스 연결 env(APP_DATASOURCE_URL, APP_DATASOURCE_USERNAME, APP_DATASOURCE_PASSWORD) |
| 항상 (키 7종과 각 키 id, 32바이트 이상 base64, 서로 달라야 함) | APP_NOTIFICATION_PLATFORM_{CONTACT_ENCRYPTION,CONTACT_LOOKUP_HMAC,CALLBACK_SIGNING,PROVIDER_CREDENTIAL,PAYLOAD_ENCRYPTION,PROVIDER_REQUEST_LOOKUP_HMAC,CALLBACK_FINGERPRINT_HMAC}_KEY, 같은 이름 + _ID |
| SMTP provider | APP_NOTIFICATION_PLATFORM_SMTP_ENABLED=true, APP_NOTIFICATION_PLATFORM_SMTP_SENDER_IDENTITY, SPRING_MAIL_HOST, SPRING_MAIL_PORT, SPRING_MAIL_USERNAME, SPRING_MAIL_PASSWORD |
| SES provider | APP_NOTIFICATION_PLATFORM_SES_ENABLED=true, APP_NOTIFICATION_PLATFORM_SES_SENDER_IDENTITY, APP_NOTIFICATION_PLATFORM_SES_ACCESS_KEY_ID, APP_NOTIFICATION_PLATFORM_SES_CREDENTIAL_KEY_ID, APP_NOTIFICATION_PLATFORM_SES_REGION |
| provider 콜백 | APP_NOTIFICATION_PLATFORM_CALLBACKS_ENABLED=true, SES는 APP_NOTIFICATION_PLATFORM_SES_ALLOWED_TOPIC_ARNS, 프록시 뒤라면 APP_SERVER_FORWARD_HEADERS_STRATEGY=native + server.tomcat.remoteip.internal-proxies(콜백 전용 프록시 목록은 없다) |
나머지(발송 배치 크기, lease, 준비 상태 임계값 등)는 기본값으로 동작한다. 설명은
docs/notification/configuration-reference.md.