Developed by the Firefly Software Foundation. dev@fireflysoftware.io
Website · OpenPlatform · Module catalogue
Domain layer microservice for multi-channel notification orchestration. This service manages the full notification lifecycle -- routing, delivery (email via SendGrid, SMS via Twilio), auditing, read-status tracking, deletion, and per-party preference management -- within the Firefly platform.
Repository: https://github.com/firefly-oss/domain-common-notifications
domain-common-notifications provides a reactive REST API for sending notifications through email and SMS channels, then reading that sent history per party. Each send operation is orchestrated via a multi-step saga that routes the message to the correct channel, delivers it through the configured provider, and records the message the notification core accepted. The notification core only sends, so this service keeps that outbound record and serves get, detail, mark read, mark all read, and delete from it.
- Multi-channel delivery -- sends notifications via email (SendGrid) or SMS (Twilio), with automatic channel selection when set to
AUTO. - Saga-orchestrated workflows -- the
SendNotificationSagaroutes, delivers, and audits each notification using the FireflyFramework Transactional Saga Engine with retry policies and compensating actions. - Bulk send -- dispatches multiple notifications in a single request, executing a saga per message.
- Notification lifecycle management -- retrieve notifications by party (paginated), fetch individual notification details, mark single or all notifications as read, and delete notifications. These operations read the messages this service already sent.
- Event-driven architecture -- publishes domain events (
notification.delivered,notification.sent) via Kafka through the FireflyFramework EDA module. - CQRS -- separates commands (send, mark-read, delete) from queries (get by party, get detail) through dedicated command and query buses.
- Reactive, non-blocking architecture -- built on Spring WebFlux and Project Reactor for high-throughput, low-latency processing.
- OpenAPI documentation -- integrated Swagger UI via SpringDoc for interactive API exploration.
- Observability -- Prometheus metrics via Micrometer and Spring Boot Actuator health/readiness/liveness endpoints.
| Module | Purpose |
|---|---|
domain-common-notifications-core |
Business logic: command/query handlers, service interfaces/implementations, saga workflows, domain models, and constants. |
domain-common-notifications-interfaces |
Interface adapters: bridges between web layer and core domain; depends on core. |
domain-common-notifications-infra |
Infrastructure: configuration properties, external SDK client factory (email/SMS APIs), provider integrations (SendGrid, Twilio). |
domain-common-notifications-web |
Deployable Spring Boot application: REST controllers, OpenAPI config, actuator endpoints. |
domain-common-notifications-sdk |
Auto-generated client SDK for consumers of this service's API, produced from the OpenAPI spec via openapi-generator-maven-plugin. |
web --> interfaces --> core --> infra
| Technology | Purpose |
|---|---|
| Java 25 | Language runtime |
| Spring Boot (WebFlux) | Reactive web framework |
| Project Reactor | Reactive streams |
| FireflyFramework Parent | Parent POM and dependency management |
| FireflyFramework Transactional Saga Engine | Distributed saga orchestration (SagaResult, @Saga, @SagaStep) |
| FireflyFramework CQRS | Command and query bus (CommandBus, QueryBus, @CommandHandlerComponent, @QueryHandlerComponent) |
| FireflyFramework Notifications Core | Notification provider abstractions (EmailProvider, SMSProvider) |
| FireflyFramework Notifications SendGrid | SendGrid email provider implementation |
| FireflyFramework Notifications Twilio | Twilio SMS provider implementation |
| FireflyFramework EDA | Event-driven architecture with Kafka publishers |
| FireflyFramework Utils | Common utilities |
| FireflyFramework Domain | Domain abstractions (fireflyframework-starter-domain) |
| FireflyFramework Validators | Validation utilities |
| FireflyFramework Web | Common web configurations |
| core-common-notification-services-sdk | SDK client for the core Notification Services platform (audit APIs) |
| SpringDoc OpenAPI (WebFlux UI) | API documentation |
| Micrometer + Prometheus | Metrics and monitoring |
| OpenAPI Generator | SDK code generation from OpenAPI spec |
| MapStruct | Object mapping |
| Lombok | Boilerplate reduction |
- Java 25 (or later)
- Apache Maven 3.9+
- Access to the FireflyFramework Maven repository for
org.fireflyframeworkdependencies - Access to the
core-common-notification-services-sdkartifact - A running Kafka broker (default:
localhost:9092) for event publishing - SendGrid API key and/or Twilio credentials for outbound delivery
| Variable | Default | Description |
|---|---|---|
SERVER_ADDRESS |
localhost |
Address the server binds to |
SERVER_PORT |
8080 |
HTTP port |
SENDGRID_API_KEY |
(empty) | SendGrid API key for email delivery |
TWILIO_ACCOUNT_SID |
(empty) | Twilio account SID for SMS delivery |
TWILIO_AUTH_TOKEN |
(empty) | Twilio auth token for SMS delivery |
TWILIO_PHONE_NUMBER |
(empty) | Twilio sender phone number for SMS |
Additional configuration is managed in application.yaml:
| Property | Default | Description |
|---|---|---|
firefly.cqrs.command.timeout |
30s |
Command bus execution timeout |
firefly.cqrs.query.timeout |
15s |
Query bus execution timeout |
firefly.cqrs.query.cache-ttl |
15m |
Query result cache TTL |
firefly.notifications.email.provider |
sendgrid |
Email delivery provider |
firefly.notifications.sms.provider |
twilio |
SMS delivery provider |
api-configuration.common-platform.notification-services.base-path |
http://localhost:8095 |
Base URL for core notification services SDK |
# Full build
mvn clean install
# Skip tests
mvn clean install -DskipTests# Run via Spring Boot Maven plugin
mvn -pl domain-common-notifications-web spring-boot:run
# Or run the packaged JAR
java -jar domain-common-notifications-web/target/domain-common-notifications.jarAll endpoints return reactive responses. The base API path prefix is /api/v1/notifications.
| Method | Path | Summary | Description |
|---|---|---|---|
POST |
/api/v1/notifications/send |
Send notification | Send a single notification through the appropriate channel (EMAIL, SMS, or AUTO) |
POST |
/api/v1/notifications/send-bulk |
Send bulk notifications | Send multiple notifications in bulk; each is dispatched through its own saga |
GET |
/api/v1/notifications/party/{partyId} |
Get notifications for party | Retrieve paginated notifications for a given party (page and size query params) |
GET |
/api/v1/notifications/{notificationId} |
Get notification detail | Retrieve details of a specific notification; returns 404 if not found |
PATCH |
/api/v1/notifications/{notificationId}/read |
Mark notification as read | Mark a specific notification as read (partyId query param required) |
POST |
/api/v1/notifications/party/{partyId}/read-all |
Mark all notifications as read | Mark all notifications for a party as read |
DELETE |
/api/v1/notifications/{notificationId} |
Delete notification | Delete a specific notification (partyId query param required) |
Each POST /send invocation triggers the following DAG-based saga:
routeNotification (Layer 0)
+-- deliverEmail (Layer 1, retry=3, backoff=2000ms, jitter)
| +-- auditEmail (Layer 2, dependsOn deliverEmail, retry=2, backoff=500ms)
+-- deliverSms (Layer 1, retry=3, backoff=2000ms, jitter)
+-- auditSms (Layer 2, dependsOn deliverSms, retry=2, backoff=500ms)
Only the branch matching the resolved channel executes. Compensating actions log warnings for irreversible delivery operations.
The domain-common-notifications-sdk module generates a reactive Java client SDK from the service's OpenAPI specification using openapi-generator-maven-plugin (v7.0.1).
| Package | Contents |
|---|---|
io.fireflysoftware.domain.common.notifications.sdk.api |
NotificationsApi -- typed API client |
io.fireflysoftware.domain.common.notifications.sdk.model |
SendNotificationCommand, SendBulkNotificationCommand, NotificationDTO -- request/response models |
io.fireflysoftware.domain.common.notifications.sdk.invoker |
ApiClient and authentication helpers |
Add the SDK dependency to your consumer project:
<dependency>
<groupId>io.fireflysoftware</groupId>
<artifactId>domain-common-notifications-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>The SDK uses the webclient library with reactive support, returning Mono and Flux types.
The SDK is generated during the Maven build from the OpenAPI spec produced by the -web module:
mvn clean installThe input spec is read from domain-common-notifications-web/target/openapi/openapi.yml.
# Run all tests
mvn test
# Run tests for a specific module
mvn -pl domain-common-notifications-core test
mvn -pl domain-common-notifications-web testThe project includes unit tests for the following components:
| Module | Test Class | Covers |
|---|---|---|
core |
SendEmailHandlerTest |
Email delivery handler |
core |
SendSmsHandlerTest |
SMS delivery handler |
core |
AuditEmailHandlerTest |
Email audit recording |
core |
AuditSmsHandlerTest |
SMS audit recording |
core |
MarkNotificationReadHandlerTest |
Single notification read-status |
core |
MarkAllNotificationsReadHandlerTest |
Bulk read-status update |
core |
DeleteNotificationHandlerTest |
Notification deletion |
core |
GetNotificationsByPartyHandlerTest |
Party notification retrieval |
core |
GetNotificationDetailHandlerTest |
Single notification detail |
core |
SentNotificationStoreTest |
Sent-message inbox record |
core |
NotificationServiceImplTest |
Service orchestration logic |
web |
NotificationControllerTest |
Notification REST endpoints |
Dependencies for testing include spring-boot-starter-test and reactor-test.
The web module includes spring-boot-starter-actuator with the following endpoints:
| Endpoint | Purpose |
|---|---|
/actuator/health |
Application health check with liveness/readiness probes |
/actuator/info |
Build information |
/actuator/prometheus |
Prometheus-compatible metrics |
Prometheus metrics are exported via micrometer-registry-prometheus. CQRS command and query metrics are enabled by default. Scrape the /actuator/prometheus endpoint for time-series data.
Interactive API documentation is available at:
- Swagger UI:
/swagger-ui.html - OpenAPI JSON:
/v3/api-docs