Implement shared email notification orchestration (Thymeleaf renderer, per-type builders) - #1
Conversation
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abece28ca8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public EmailNotificationOrchestrator( | ||
| NotificationCatalog catalog, | ||
| TemplateRenderer renderer, | ||
| EmailPublicationPublisher publisher, | ||
| List<NotificationModelBuilder<?>> builders |
There was a problem hiding this comment.
Provide a concrete EmailPublicationPublisher bean
EmailNotificationOrchestrator is a @Service with a required constructor dependency on EmailPublicationPublisher, but a repo-wide search (rg in src/main/java) shows only the interface and no @Component/@Bean implementation. In this commit, that leaves the Spring context unable to create the orchestrator (and therefore HoldListDomainService), so the application will fail to start with an unsatisfied dependency.
Useful? React with 👍 / 👎.
| for (NotificationModelBuilder<?> builder : builders) { | ||
| this.buildersByType.put(builder.type(), builder); |
There was a problem hiding this comment.
Reject duplicate model builders per notification type
The constructor populates buildersByType with put but never checks for an existing entry, so if two NotificationModelBuilder beans return the same NotificationType, one silently overwrites the other. That can route notifications through the wrong builder based on bean ordering, producing incorrect models or runtime payload-type errors; this should fail fast on duplicate registrations.
Useful? React with 👍 / 👎.
Motivation
payload -> template modelconversion to lower cognitive load when adding types.application.ymlrather than scattered code.Description
EmailNotificationOrchestratorand a light strategy interfaceNotificationModelBuilder<T>that are wired via constructor injection and a simpleEnumMapregistry.NotificationPropertiesandNotificationDefinitionplusNotificationCatalogfor centralized lookup ofnotifications.emailentries.TemplateRendererand a Thymeleaf-backedThymeleafTemplateRenderer, and an outgoing messageEmailPublicationRequestwith a publisher interfaceEmailPublicationPublisher(no delivery implementation).HOLD_LIST_CREATED,HOLD_LIST_REMOVED) with payload records, small builder components, templates underresources/templates, and a sampleapplication.ymlshowing how to configure recipients/template/subject/enabled; also added focused unit tests for orchestrator behavior insrc/test/java/....Testing
EmailNotificationOrchestratorTestthat cover happy-path publish, skipping disabled notifications, multi-type support, and payload-type mismatch guards.mvn testin this environment but the run failed due to dependency download issues (Maven Central returned HTTP 403 when fetching the Spring Boot parent POM), so the automated tests could not be completed here.TemplateRendererandEmailPublicationPublisherso they should pass once dependencies are available and Maven can download artifacts.Codex Task