adb-utilities
AI-generated content
This document was generated by an AI assistant. Verify accuracy before relying on the details.
Role
Cross-cutting services consumed by every other microservice. It provides:
- Catalogs and translations (
/utilities/catalog,/utilities/i18n) — multilingual reference tables. - Business configuration (
/utilities/configurations) — formats, sequences, charges, parameters. - Allocation keys (
/utilities/allocationkey) — rules to allocate charges across lots. - INSEE indices (
/utilities/indexes) — IRL, ILC, ILAT, ICC indices for rent revisions, refreshed daily at noon by a cron job. - Notifications (
/utilities/notifications,/utilities/notification-definitions) — the admin banners: an administrator defines a notification (notification_definitions), its activation fans out one organisation-level instance per target organisation (notifications), and each user's copy is materialised when they read/utilities/notifications/assigned. See Notification fan-out. - UI logs (
/utilities/logs) — collects client-side logs. - Dashboards (
/utilities/dashboards) — user dashboard configuration. - Validations (
/utilities/validations) — reusable business validation rules.
Tech stack
| Item | Value |
|---|---|
| Spring Boot | 3.1.3 |
| Java | 18 |
| Port | 8082 |
| Database | MongoDB Atlas — database adb-utilities |
| Auth | Keycloak (resource server) |
| Reactive stack | Spring WebFlux + Reactive MongoDB |
| State machine | Spring Statemachine 2.2.3 |
| Integration | INSEE API (banking indices) |
| Version | 0.40.0-SNAPSHOT |
Internal architecture
flowchart TB
subgraph Controllers["12 Controllers"]
CC[CatalogController]
I18N[I18NController]
CFC[ConfigurationController]
AKC[AllocationKeysController]
IC[IndexController]
NC[NotificationController]
NDC[NotificationDefinitionController]
DC[DashboardController]
VC[ValidationsController]
SC[SerialController]
ULC[UiLogsController]
INFOC[InfoController]
end
subgraph Jobs
InseeJob[INSEE Job<br/>cron: 0 0 12 * * *]
end
Mongo[(adb-utilities)]
INSEE[INSEE API]
Controllers --> Mongo
InseeJob --> INSEE
InseeJob --> Mongo
InseeJob -.publish.-> SNS[SNS<br/>onIndexPublished]
Endpoints (12 controllers)
| Controller | Path | Role |
|---|---|---|
CatalogController | /utilities/catalog | Catalogs of values (types, statuses, ...) |
I18NController | /utilities/i18n | Multilingual translations |
ConfigurationController | /utilities/configurations | Global configuration |
AllocationKeysController | /utilities/allocationkey | Allocation keys |
IndexController | /utilities/indexes | INSEE indices |
NotificationController | /utilities/notifications | User notifications |
NotificationDefinitionController | /utilities/notification-definitions | Notification definitions |
DashboardController | /utilities/dashboards | User dashboards |
ValidationsController | /utilities/validations | Validation rules |
SerialController | /utilities/serials | Serial numbers |
UiLogsController | /utilities/logs | UI logs |
InfoController | /utilities | Module info |
Data model
erDiagram
AllocationKeyEntity ||--o{ Configuration : "references"
AllocationKeyEntity {
string _id
string name
object rules
}
AbstractConfigurationEntity {
string _id
string type "format / serial / charge / ..."
object data
}
CatalogValueEntity {
string _id
string catalog
string code
object translations
}
InseeIndexEntity {
string _id
string bankId "IRL / ILC / ILAT / ICC"
date publishedAt
number value
}
NotificationDefinitionEntity {
string _id
string type
string template
}
NotificationEntity {
string _id
ObjectId definitionId
TargetObject organisation
TargetObject user
object schedule
string notificationType
string payload
boolean acknowledgeable
string state
}
Collections: allocationkeys, configurations, dashboards, catalog, indexes, notifications, notification_definitions, serials.
Events
Emitted (SNS)
onIndexPublished— when the INSEE job publishes a new index (consumed byadb-contractsto re-index rents).
Consumed
No SQS listener — adb-utilities is purely a producer or read-only.
Notification fan-out (banners)
Two collections, three steps:
| Step | Who | Writes |
|---|---|---|
| 1. Define | administrator, POST/PUT/PATCH /utilities/notification-definitions | one notification_definitions document, owned by the administrator's organisation (organisationId), with the target organisations, channels, schedule and state |
| 2. Fan out | NotificationDefinitionServiceImpl#fanOut, on every write path while the definition is ACTIVE | the definition's previous instances are deleted (deleteAllByDefinitionId), then one organisation-level instance per target organisation × channel is inserted into notifications: organisationId = the target organisation, no user, state: SENT |
| 3. Assign | each user, GET /utilities/notifications/assigned (CustomNotificationRepositoryImpl#findAssigned) | a $merge aggregation clones every live, user-less instance of the caller's organisation into a per-user copy (user.targetId = the caller's person), once; the read returns the caller's copies in state SENT/RECEIVED whose schedule window contains now |
Visibility is gated at read time on schedule.start <= now < schedule.end, so a definition scheduled in the future is materialised at activation and surfaces at its start; deactivating, updating or deleting the definition removes every instance (broadcasts and per-user copies alike). The SPA (adb-ui banner.service.ts) reads /assigned on load and PATCHes each copy to RECEIVED, then ACKNOWLEDGED when dismissed.
History. Until 2026-09 step 2 did not exist in the service: it was performed by two hand-managed Atlas triggers of the triggers-kkeqz app (notification-definition-modified → a TTL document in notifications_ttl → notification-ttl-deleted → insertMany into notifications, see Atlas Triggers). Those exist on one cluster only, so on staging, on the local stack and in the Cloudflare port an activated banner never reached anyone (measured on staging 0.68.0 and on the local stack, 2026-09-23). The property notifications.fan-out.enabled (env NOTIFICATIONS_FANOUT_ENABLED, default true) exists for the cutover: it must be false only where the two triggers are still enabled, otherwise every banner is produced twice. The Cloudflare port (services/utilities, src/notificationDefinitions.mjs) mirrors the same write paths.
Inter-service dependencies
flowchart LR
utilities[adb-utilities]
insee[INSEE API]
utilities --> insee
parts[adb-parts] -->|GET /utilities/allocationkey| utilities
contracts[adb-contracts] -->|GET /utilities/i18n| utilities
accounting[adb-accounting] -->|GET /utilities/i18n| utilities
web[adb-web/bff] --> utilities
ui[adb-ui] --> utilities
adb-utilities does not call any other business service.
Seeding / pipeline scripts
The pipeline_scripts/ directory contains shell scripts for bootstrapping configuration data into a target environment. They read TSV files from the module root and POST documents directly to MongoDB via mongosh.
| Script | Input | Purpose |
|---|---|---|
import_event_configuration_values.sh | *-values-input.tsv | Seeds catalog / i18n translation values |
import_ticket_configuration_values.sh | TICKET-values-input.tsv | Seeds TicketEventConfigurationEntity records |
delete_mongo_file_configuration_data.js | (no TSV) | Removes stale file-configuration documents |
Translation TSV files present in the repo root (ACCOUNTING-values-input.tsv, ADMIN-values-input.tsv, CATALOG-values-input.tsv, COMMON-values-input.tsv, CONTRACTS-values-input.tsv, DOCUMENTS-values-input.tsv, JEDI-values-input.tsv, LISTS-values-input.tsv, NACE-values-input.tsv, NOTES-values-input.tsv, PARTS-values-input.tsv, PERSONS-values-input.tsv, SEARCH-values-input.tsv, TICKET-values-input.tsv) represent one domain per file; each row is a translation entry (key, locale, value).
INSEE Job
A Spring job (cron 0 0 12 * * * — every day at noon) that:
- Calls the INSEE API with the credentials
insee.consumer.key/insee.consumer.secret. - Fetches the IRL, ILC, ILAT, ICC indices.
- Persists them in the
indexescollection. - Publishes the
onIndexPublishedevent to SNS.
Can be disabled via insee.job.enabled=false.
Configuration / deployment
Environment variables
| Variable | Role |
|---|---|
MONGO_DB_URI | MongoDB connection string |
SECURITY_ISSUER_URI / SECURITY_TOKEN_URI | Keycloak |
CLIENT_ID / CLIENT_SECRET | OAuth2 |
insee.consumer.key / insee.consumer.secret | INSEE API |
IRL_bankIds, ILC_bankIds, ILAT_bankIds, ICC_bankIds | INSEE IDs per index type |
insee.job.enabled | Cron toggle |
insee.job.cron | Cron expression |
notifications.fan-out.enabled (NOTIFICATIONS_FANOUT_ENABLED) | Materialise the organisation-level notification instances in the service on (re)activation — default true; false only where the legacy Atlas notification triggers still run |
Helm chart
adb-charts/charts/services/templates/adb-utilities.yaml. Image: lifeconnect/adb-utilities.
Links
- Code:
adb-utilities/ - Allocation keys docs:
functional-epics/utility/allocation-keys.md - Revision index docs:
functional-epics/utility/revision-index.md