# eclipse-ecsp/notification-center architecture

> Architecture diagram of the GitHub repository eclipse-ecsp/notification-center, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eclipse-ecsp/notification-center
- Repository: https://github.com/eclipse-ecsp/notification-center

## Overview

##### Project Type and Purpose
- Notification Center is a Java-based, event-driven microservice (Maven multi-module) that provides a unified API for sending notifications (push, email, SMS, in-vehicle messaging) and managing notification templates, configurations, preferences, and history.
- It comprises two deployable services:
- notification-api (“api” module) – REST API for provisioning templates, sending notifications, querying history, user/vehicle preferences, etc.
- notification-sp (“sp” module) – stream processor that consumes notification events from a message bus, applies business logic (deduplication, scheduling, content transformation), and dispatches to external channels.

##### Key Modules & File‐Structure Indicators
- Top-level modules:
- api – Spring Boot REST service (controllers, DTOs, services, Mongo migrations via Mongock).
- sp – Stream‐processing service (Ignite or Kafka listener, scheduling processors, channel notifiers).
- utility – CLI or background job for bulk template/config updates.
- common-model & notification-common – shared POJOs, DAOs, repositories, utilities for MongoDB, DynamoDB, Redis, and AWS integrations.
- Infra config: Dockerfiles, application.properties, Kafka keystores, CI/CD workflows.

a. Main Components
- Clients: Mobile App / Web UI / Vehicle Telematics
- notification-api
‣ HTTP REST Controllers
‣ Service Layer (template management, sendNotification)
‣ MongoDB (templates, config, history)
‣ Kafka Producer (or AWS Kinesis)
- notification-sp
‣ Kafka Consumer / Stream Listener
‣ Processing Chain (deduplicator, scheduler, content transformers)
‣ Cache Layer (Ignite, Redis)
‣ Channel Adapters (AWS Pinpoint, SNS, SES, MQTT broker, IVM)
‣ History Service (write back status to MongoDB)
- utility
‣ Spring CLI tool for bulk updates, reads JSON/CSV → updates MongoDB
- Shared Libraries
‣ common-model, notification-common for domain objects, DAOs, encryption, validation
- Infrastructure
‣ MongoDB cluster
‣ Kafka cluster (topics: notification-requests, retries, DLQ)
‣ Ignite / Redis for caching templates or deduplication keys
‣ External Services: AWS Pinpoint, SNS, SES, Vehicle Profile Service, User Profile Service

b. Data Flows & Interactions
1. Client → HTTP → notification-api
2. notification-api validates request → persists to MongoDB → publishes event to Kafka topic
3. notification-sp subscribes to Kafka → pulls event → goes through processing chain
4. processing chain may enrich event by calling User/Vehicle Profile Service, apply deduplication using Redis or Ignite, schedule (immediate or delayed)
5. after transformation, channel adapter sends to external service (e.g., AWS Pinpoint for push, SES/SNS for email/SMS, MQTT broker for browser, proprietary IVM)
6. success/failure callback or status update → notification-sp writes back history/status to MongoDB
7. Client can query history via notification-api (reads from MongoDB)

##### Architectural Patterns & Principles
- Microservices: Two deployables (api, sp) each with its own lifecycles, Docker images, K8s pods
- Event-driven: decoupling via Kafka (or Kinesis) topics
- Layered (hexagonal) architecture: Controllers → Services → DAOs → External Adapters
- Shared domain libs (common-model, notification-common) to enforce contracts across modules
- Cache aside: Ignite/Redis caches for high-throughput deduplication/content lookup
- CI/CD & Infrastructure as Code: Dockerfiles, Helm charts, GitHub Actions workflows

##### Essential Details to Capture
- Modules & their boundaries (api vs sp vs utility)
- Message broker as the integration point
- Database reads/writes for templates, config, history
- Cache lookups for dedup / content templates
- External channel adapters & the specific channel services
- Shared library dependencies – highlight common-model & notification-common as JAR dependencies

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        MobileApp["Mobile App"]:::client
        WebUI["Web UI"]:::client
        Vehicle["Vehicle Telematics"]:::client
    end

    %% API Layer
    subgraph "API Layer"
        APIService["notification-api\n(Spring Boot REST API)"]:::api
        Controller["HTTP REST Controllers"]:::api
        ConfigCtrl["Config Controllers"]:::api
        ServiceLayer["Service Layer"]:::api
        KafkaProducer["Kafka Producer"]:::infra
        MongoAPI["MongoDB\n(Templates, Config, History)"]:::db
        APIPom["api/pom.xml"]:::infra
        APIDocker["api/Dockerfile"]:::infra
        APIProps["application.properties"]:::infra
        Migration["Mongock Migration"]:::infra
    end

    %% Processing Layer
    subgraph "Processing Layer"
        SPService["notification-sp\n(Stream Processor)"]:::sp
        SPPom["sp/pom.xml"]:::infra
        SPDocker["sp/Dockerfile"]:::infra
        SPProps["application.properties"]:::infra
        Consumer["Kafka Consumer"]:::infra
        Chain["Processing Chain\n(Deduplicator, Scheduler, Transformers)"]:::sp
        CacheLayer["Cache Layer\n(Ignite/Redis)"]:::cache
        ChannelAdapters["Channel Adapters\n(AWS Pinpoint, SNS, SES, MQTT, IVM)"]:::ext
        HistoryWriter["History Service\n(Write to MongoDB)"]:::db
    end

    %% Utility Module
    subgraph "Utility Module"
        UtilityCLI["utility CLI\n(Bulk Config Updates)"]:::util
        UtilPom["utility/pom.xml"]:::infra
        UtilDocker["utility/Dockerfile"]:::infra
        UtilProps["application.properties"]:::infra
        UtilService["Config Update Service"]:::util
    end

    %% Shared Libraries
    subgraph "Shared Libraries"
        CommonModel["common-model"]:::shared
        CMpom["common-model/pom.xml"]:::infra
        CMdto["ContentProcessingContextDto"]:::shared
        CMtransform["ContentTransformer"]:::shared
        NotifCommon["notification-common"]:::shared
        NCPom["notification-common/pom.xml"]:::infra
        NCReq["NotificationRequest"]:::shared
        NCResp["ChannelResponse"]:::shared
        NCCnotifier["ChannelNotifier"]:::shared
        NCCDAO["NotificationConfigDAO"]:::shared
        NCMongoClient["MongoDbClient"]:::shared
        NCException["EncryptionDecryptionException"]:::shared
    end

    %% Infrastructure & External Services
    subgraph "Infrastructure"
        MongoCluster["MongoDB Cluster"]:::db
        KafkaCluster["Kafka Cluster"]:::infra
        IgniteRedis["Ignite/Redis Cache"]:::cache
    end

    subgraph "External Services"
        AWS["AWS Pinpoint/SNS/SES"]:::ext
        ProfileService["User/Vehicle Profile Service"]:::ext
        MQTTBroker["MQTT Broker"]:::ext
    end

    %% Data Flows
    MobileApp -->|"HTTP POST /notifications"| Controller
    WebUI -->|"HTTP POST /notifications"| Controller
    Vehicle -->|"HTTP POST /notifications"| Controller

    Controller -->|validate & call| ServiceLayer
    ServiceLayer -->|write templates & history| MongoAPI
    ServiceLayer -->|publish event| KafkaProducer
    KafkaProducer -.->|topic=notification-requests| KafkaCluster

    KafkaCluster -.->|consume| Consumer
    Consumer -->|process event| Chain
    Chain -->|enrich via| ProfileService
    Chain -->|dedup/cache lookup| CacheLayer
    Chain -->|dispatch| ChannelAdapters
    ChannelAdapters -->|push/email/sms| AWS
    ChannelAdapters -->|browser notifications| MQTTBroker
    ChannelAdapters -->|in-vehicle messaging| AWS

    Chain -->|status update| HistoryWriter
    HistoryWriter -->|write| MongoCluster

    MobileApp -->|GET history| Controller
    WebUI -->|GET history| Controller

    UtilityCLI -->|bulk update| UtilService
    UtilService -->|write| MongoCluster

    %% Shared Dependencies
    CommonModel -.-> APIService
    CommonModel -.-> SPService
    CommonModel -.-> UtilityCLI
    NotifCommon -.-> APIService
    NotifCommon -.-> SPService
    NotifCommon -.-> UtilityCLI

    %% Click Events for API Module
    click APIService "https://github.com/eclipse-ecsp/notification-center/tree/main/api/"
    click APIPom "https://github.com/eclipse-ecsp/notification-center/blob/main/api/pom.xml"
    click APIDocker "https://github.com/eclipse-ecsp/notification-center/tree/main/api/Dockerfile"
    click Controller "https://github.com/eclipse-ecsp/notification-center/blob/main/api/src/main/java/org/eclipse/ecsp/platform/notification/create/NotificationController.java"
    click ServiceLayer "https://github.com/eclipse-ecsp/notification-center/blob/main/api/src/main/java/org/eclipse/ecsp/platform/notification/service/NotificationServiceImpl.java"
    click ConfigCtrl "https://github.com/eclipse-ecsp/notification-center/blob/main/api/src/main/java/org/eclipse/ecsp/platform/notification/config/NotificationConfigController.java"
    click APIProps "https://github.com/eclipse-ecsp/notification-center/blob/main/api/src/main/resources/application.properties"
    click Migration "https://github.com/eclipse-ecsp/notification-center/blob/main/api/src/main/java/org/eclipse/ecsp/changelog/MongockMigration.java"

    %% Click Events for SP Module
    click SPService "https://github.com/eclipse-ecsp/notification-center/tree/main/sp/"
    click SPPom "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/pom.xml"
    click SPDocker "https://github.com/eclipse-ecsp/notification-center/tree/main/sp/Dockerfile"
    click IgniteBase "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/IgniteEventStreamProcessorBase.java"
    click AlertChain "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/processors/AlertProcessorChain.java"
    click Deduplicator "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/duplication/Deduplicator.java"
    click RedisConfig "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/config/RedisDbConfig.java"
    click PinpointNotifier "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/aws/pinpoint/AmazonPinpointNotifier.java"
    click EmailNotifier "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/email/SmtpEmailNotifier.java"
    click IvmNotifier "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/java/org/eclipse/ecsp/notification/ivm/IvmNotifierImpl.java"
    click SPProps "https://github.com/eclipse-ecsp/notification-center/blob/main/sp/src/main/resources/application.properties"

    %% Click Events for Utility Module
    click UtilityCLI "https://github.com/eclipse-ecsp/notification-center/blob/main/utility/src/main/java/org/eclipse/ecsp/platform/notification/utility/NotificationConfigUtility.java"
    click UtilService "https://github.com/eclipse-ecsp/notification-center/blob/main/utility/src/main/java/org/eclipse/ecsp/platform/notification/utility/service/NotificationConfigUpdateService.java"
    click UtilPom "https://github.com/eclipse-ecsp/notification-center/blob/main/utility/pom.xml"
    click UtilDocker "https://github.com/eclipse-ecsp/notification-center/tree/main/utility/Dockerfile"
    click UtilProps "https://github.com/eclipse-ecsp/notification-center/blob/main/utility/src/main/resources/application.properties"

    %% Click Events for Shared Libraries
    click CommonModel "https://github.com/eclipse-ecsp/notification-center/tree/main/common-model/"
    click CMpom "https://github.com/eclipse-ecsp/notification-center/blob/main/common-model/pom.xml"
    click CMdto "https://github.com/eclipse-ecsp/notification-center/blob/main/common-model/src/main/java/org/eclipse/ecsp/processor/content/dto/ContentProcessingContextDto.java"
    click CMtransform "https://github.com/eclipse-ecsp/notification-center/blob/main/common-model/src/main/java/org/eclipse/ecsp/processor/content/plugin/ContentTransformer.java"
    click NotifCommon "https://github.com/eclipse-ecsp/notification-center/tree/main/notification-common/"
    click NCPom "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/pom.xml"
    click NCReq "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/domain/notification/NotificationRequest.java"
    click NCResp "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/domain/notification/ChannelResponse.java"
    click NCCnotifier "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/notification/adaptor/ChannelNotifier.java"
    click NCCDAO "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/notification/config/NotificationConfigDAO.java"
    click NCMongoClient "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/notification/db/client/MongoDbClient.java"
    click NCException "https://github.com/eclipse-ecsp/notification-center/blob/main/notification-common/src/main/java/org/eclipse/ecsp/security/EncryptionDecryptionException.java"

    %% Styles
    classDef client fill:#AED6F1,stroke:#2980B9,color:#1B2631;
    classDef api fill:#D6EAF8,stroke:#5DADE2,color:#154360;
    classDef sp fill:#FDEBD0,stroke:#F5B041,color:#6E2C00;
    classDef util fill:#E8DAEF,stroke:#AF7AC5,color:#4A235A;
    classDef db fill:#D1F2EB,stroke:#45B39D,color:#0B5345;
    classDef cache fill:#E8F8F5,stroke:#48C9B0,color:#117A65;
    classDef infra fill:#F5F5F5,stroke:#D5DBDB,color:#1C2833;
    classDef ext fill:#E8DAEF,stroke:#BB8FCE,color:#4A235A;
    classDef shared fill:#F2F3F4,stroke:#ABB2B9,color:#2C3E50;
```
