ADR-001: Keep notification ownership inside BookWorm
BookWorm treats SendGrid as an external delivery provider while the Notification System owns notification state, business meaning, and delivery policy.
1. Context & Problem
BookWorm uses SendGridSystemv1.0.0SendGridExternal email delivery platform used by BookWorm to submit rendered transactional emails over authenticated SMTP. Ownerplatform-engineering-teamDiagramOpen docs to deliver customer and operational email notifications, but an external delivery provider has no knowledge of the business workflows—such as an order placement—that triggered a message. If BookWorm relied on the external provider to hold notification status or treated a provider response as proof of business completion, domain state would become tightly coupled to a third-party service.
The architecture must draw a clear line between three distinct milestones:
- BookWorm recording that a notification needs to be sent.
- The external provider accepting a message for delivery processing.
- The message actually reaching a recipient or confirming the originating business transaction.
2. Business Value
- Vendor independence and flexibility: BookWorm can switch email providers or delivery transports without rewriting core business services or migrating notification history.
- Accurate customer and support visibility: Support teams and user-facing statuses do not misrepresent a provider’s intake acknowledgment as guaranteed inbox delivery or completed business processing.
- Domain isolation: Temporary email delays, rate limits, or delivery errors are managed by notification policies rather than corrupting or blocking order and business records.
- Centralized governance: Credentials, retry rules, and formatting standards live in one dedicated boundary rather than being duplicated across every business service.
3. How It Works
BookWorm establishes SendGridSystemv1.0.0SendGridExternal email delivery platform used by BookWorm to submit rendered transactional emails over authenticated SMTP. Ownerplatform-engineering-teamDiagramOpen docs strictly as an external delivery boundary while the Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs remains the single system of record for notification state, outbox records, retry policies, duplicate-prevention decisions, and the business meaning of delivery outcomes.
- A business capability initiates a notification need, and the Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs records the work internally in its outbox.
- The SendGrid APIServicev1.0.0SendGrid APIExternal SMTP email delivery provider used by BookWorm to submit rendered order notification emails over authenticated S...Ownerplatform-engineering-teamDiagramOpen docs integration translates BookWorm’s internal notification data into the structure expected by the external provider.
- When the provider responds, an acceptance means only that the provider took the submission into its queue—not that the email reached the recipient’s inbox or that the original business action finished.
- The Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs translates the provider’s response back into its own internal delivery state and links it to the originating outbox item. Provider reference identifiers may be kept for troubleshooting, but ownership never leaves BookWorm.
4. Trade-offs & Lessons Learned
- Translation and correlation overhead: BookWorm must maintain its own delivery states, map provider outcomes into internal statuses, and correlate internal records with external reference identifiers when available.
- Distinguishing acceptance from delivery: Customer support tools and downstream consumers must treat BookWorm’s own notification states and business events as authoritative, never assuming provider acceptance equals final delivery.
- Alternatives rejected:
- Letting the provider own notification state: Would lock BookWorm into third-party status lifecycles and data retention limits.
- Treating provider acceptance as completion: Would create false-positive confirmations when messages bounce, delay, or fail downstream.
- Embedding provider logic in every business service: Would scatter credentials, formatting, and error-handling rules across the platform.
- Documented contract vs. active transport: Documenting an integration contract in the catalog does not mean that transport is currently live in production; switching delivery mechanisms requires explicit engineering and operational rollout.
5. Technical Reference
Ownership & Integration Boundary
- Applies to: SendGridSystemv1.0.0SendGridExternal email delivery platform used by BookWorm to submit rendered transactional emails over authenticated SMTP. Ownerplatform-engineering-teamDiagramOpen docs, Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs, and SendGrid APIServicev1.0.0SendGrid APIExternal SMTP email delivery provider used by BookWorm to submit rendered order notification emails over authenticated S...Ownerplatform-engineering-teamDiagramOpen docs.
- System of record: The Notification SystemSystemv1.0.0Notification SystemInternal platform system that consumes order commands, renders email templates, and submits messages over SMTP. Ownerplatform-engineering-teamDiagramOpen docs owns notification state, outbox persistence, retry policies, idempotency decisions, and domain interpretation of provider responses.
- Provider adapter role: SendGrid APIServicev1.0.0SendGrid APIExternal SMTP email delivery provider used by BookWorm to submit rendered order notification emails over authenticated S...Ownerplatform-engineering-teamDiagramOpen docs maps internal notification payloads to SendGrid’s HTTP contract and records provider responses for correlation without transferring data ownership.
Current Implementation Alignment
- The cataloged SendGrid APIServicev1.0.0SendGrid APIExternal SMTP email delivery provider used by BookWorm to submit rendered order notification emails over authenticated S...Ownerplatform-engineering-teamDiagramOpen docs documents SendGrid’s HTTP Mail Send API contract.
- The current Notification implementation sends email using MailKit over SMTP (with MailPit in local development) and does not invoke the SendGrid HTTP Mail Send API or persist provider HTTP responses.
- Switching between SMTP and SendGrid’s HTTP API requires an explicit integration and operational change; the catalog entry documents the provider contract rather than asserting active HTTP usage.