Implement boring, extensible email notification orchestration pattern - #3
Conversation
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc448a9616
ℹ️ 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".
| recipients: | ||
| - ops@example.com | ||
| - support@example.com | ||
| templatePath: templates/notifications/hold-list-created |
There was a problem hiding this comment.
Remove
templates/ prefix from templatePath values
ThymeleafTemplateRenderer.render passes definition.templatePath() directly to TemplateEngine.process(...), and with Spring Boot’s default Thymeleaf resolver that path is already prefixed with classpath:/templates/. Setting templatePath to templates/notifications/hold-list-created makes resolution look for classpath:/templates/templates/notifications/hold-list-created.html, so rendering enabled notifications will fail at runtime (TemplateInputException). Use template names relative to the templates root (for example notifications/hold-list-created) for both entries.
Useful? React with 👍 / 👎.
| NotificationCatalog catalog, | ||
| NotificationModelBuilderRegistry builderRegistry, | ||
| TemplateRenderer templateRenderer, | ||
| EmailPublicationPublisher publisher |
There was a problem hiding this comment.
Provide a concrete EmailPublicationPublisher bean
EmailNotificationOrchestrator is a @Service with a required constructor dependency on EmailPublicationPublisher, but this commit only adds the interface and no @Component/@Bean implementation in src/main. As a result, booting NotificationApplication in this repo will fail during context initialization with an unsatisfied dependency before any notification flow can run.
Useful? React with 👍 / 👎.
Motivation
EmailNotificationOrchestrator.notify(type, payload).EmailPublicationRequestand does not perform delivery.@ConfigurationProperties.Description
EmailNotificationOrchestratorthat looks upNotificationDefinition, delegates model construction toNotificationModelBuilderRegistry, renders viaTemplateRenderer, and publishes anEmailPublicationRequestthroughEmailPublicationPublisher.NotificationProperties,NotificationDefinition, andNotificationCatalogfor centralized lookup byNotificationType.TemplateRendererplus aThymeleafTemplateRendererimplementation, and a publishing abstractionEmailPublicationPublisherwith payloadEmailPublicationRequest(no Kafka implementation included by design).NotificationModelBuilder<T>with an explicit registry and two examples (HOLD_LIST_CREATEDandHOLD_LIST_REMOVED) including payload records, small builders,application.ymlentries, Thymeleaf templates, a sample domain service (HoldListDomainService), and focused unit tests.Testing
EmailNotificationOrchestratorTestandNotificationModelBuilderRegistryTestundersrc/test/javathat verify publish behavior, disabled-skip behavior, builder delegation, and payload-mismatch errors.mvn testin this environment, but the run failed due to dependency resolution being blocked (Maven Central returned HTTP 403 while resolving the Spring Boot parent POM), so tests did not execute here.Codex Task