---
title: Platform integration boundaries
summary: Scheduling, outbox durability, idempotent notification delivery, and failure boundaries across Platform services.
version: 1.0.0
type: engineering
order: 1
badges:
  - content: Architecture
    backgroundColor: green
    textColor: green
---

## Purpose & Scope

This document defines the runtime ownership, transactional outbox guarantees, idempotency semantics, and failure boundaries for [[service|scheduler-service]] and [[service|notification-api]] in the [[domain|platform]] subdomain. Neither service is exposed through the public API Gateway; use this guide when modifying scheduled jobs, Kafka consumers, or SMTP delivery pipelines.

## Visual Reference

The visual below shows how [[service|scheduler-service]] triggers [[service|catalog-ingestion]] via Kafka and how [[service|notification-api]] consumes order commands from [[service|order-orchestration]] to dispatch emails.

<MermaidFileLoader file="mermaids/platform-integration-boundaries-diagram-1.mmd" />

_Platform Scheduling, Outbox, and Notification Delivery Boundaries_

## Core Invariants & Design Rules

- **Strict storage isolation:** [[service|scheduler-service]] reads and writes only [[container|scheduler-database]] (Quartz persistent store with 30-day / 100k execution history and Wolverine outbox/inbox). It never queries or mutates Catalog, Ordering, or Qdrant stores. [[service|notification-api]] is a stateless worker with **no SQL database**, using Redis solely for FusionCache and `24h` integration-event idempotency.
- **Trigger completion vs. downstream completion:** A completed vector-batch job proves only that [[event|ProcessVectorBatchIntegrationEvent]] was durably enqueued via the PostgreSQL outbox to [[channel|scheduler.process-vector-batch]]—never that [[service|catalog-ingestion]] finished updating [[container|catalog-vector]].
- **SMTP handoff vs. business status:** [[service|notification-api]] renders email templates and hands payloads to [[service|sendgrid-api]] (or Mailpit in development) over SMTP port `587`. SMTP acceptance proves only relay handoff, never inbox delivery or authoritative order status.
- **Blank recipient safety:** Commands with null, empty, or whitespace recipient email addresses are skipped cleanly without throwing or poisoning the consumer queue.
- **Confidentiality in telemetry:** Customer email addresses and rendered HTML bodies must never appear in logs or traces; emit only order IDs, message IDs, counts, timestamps, and sanitized exception types.

:::warning
**Preserve unprefixed topic routing for `scheduler.process-vector-batch`.** [[service|catalog-ingestion]] binds its Kafka trigger directly to the unprefixed topic name [[channel|scheduler.process-vector-batch]]. Adding an environment prefix or renaming the topic breaks scheduled vector indexing silently.
:::

## Boundaries & Guarantees

| Concern                    | Strategy & Guarantee                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Failure / Edge-Case Behavior                                                                                                                                                                                                                                                         | Related Resources                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Persistence**            | <ResourceLink id="scheduler-service" type="service">scheduler-service</ResourceLink> persists Quartz triggers and Wolverine outbox/inbox in <ResourceLink id="scheduler-database" type="container">scheduler-database</ResourceLink>; <ResourceLink id="notification-api" type="service">notification-api</ResourceLink> persists no domain state.                                                                                                                          | <ResourceLink id="scheduler-service" type="service">scheduler-service</ResourceLink> outbox guarantees at-least-once publication after job commit; <ResourceLink id="notification-api" type="service">notification-api</ResourceLink> relies on Kafka offsets and Redis idempotency. | <ResourceLink id="scheduler-database" type="container">scheduler-database</ResourceLink>, <ResourceLink id="adr-001-postgresql-quartz-persistence" type="adr">adr-001-postgresql-quartz-persistence</ResourceLink>, <ResourceLink id="adr-002-notification-postgresql-email-outbox" type="adr">adr-002-notification-postgresql-email-outbox</ResourceLink>                                                                                                                                                                           |
| **Caching & Idempotency**  | <ResourceLink id="notification-api" type="service">notification-api</ResourceLink> wraps <ResourceLink id="PlaceOrderCommand" type="command">PlaceOrderCommand</ResourceLink>, <ResourceLink id="CompleteOrderCommand" type="command">CompleteOrderCommand</ResourceLink>, and <ResourceLink id="CancelOrderCommand" type="command">CancelOrderCommand</ResourceLink> handlers in a `24h` Redis integration-event idempotency guard keyed by `message.Id` and handler name. | Duplicate Kafka deliveries of the same `message.Id` are skipped; distinct retried commands from <ResourceLink id="order-orchestration" type="service">order-orchestration</ResourceLink> carry new message IDs and are processed independently.                                      | <ResourceLink id="PlaceOrderCommand" type="command">PlaceOrderCommand</ResourceLink>, <ResourceLink id="CompleteOrderCommand" type="command">CompleteOrderCommand</ResourceLink>, <ResourceLink id="CancelOrderCommand" type="command">CancelOrderCommand</ResourceLink>, <ResourceLink id="adr-001-notification-kafka-command-intake" type="adr">adr-001-notification-kafka-command-intake</ResourceLink>                                                                                                                           |
| **Messaging & Resilience** | <ResourceLink id="notification-api" type="service">notification-api</ResourceLink> applies a Polly resilience pipeline (`CircuitBreaker`, exponential `Retry` with jitter, `30s` `Timeout`) around SMTP submission, plus Wolverine retries (`50ms / 250ms / 1s` with full jitter).                                                                                                                                                                                          | Messages exhausting both Polly and Wolverine retries route to <ResourceLink id="bookworm.{env}.notification.dead-letter-queue" type="channel">`bookworm.{env}.notification.dead-letter-queue`</ResourceLink> for inspection and replay.                                              | <ResourceLink id="bookworm.{env}.finance.place-order" type="channel">`bookworm.{env}.finance.place-order`</ResourceLink>, <ResourceLink id="bookworm.{env}.finance.complete-order" type="channel">`bookworm.{env}.finance.complete-order`</ResourceLink>, <ResourceLink id="bookworm.{env}.finance.cancel-order" type="channel">`bookworm.{env}.finance.cancel-order`</ResourceLink>, <ResourceLink id="bookworm.{env}.notification.dead-letter-queue" type="channel">`bookworm.{env}.notification.dead-letter-queue`</ResourceLink> |
| **Concurrency & Misfires** | Vector-batch jobs enforce `[DisallowConcurrentExecution]` and UTC `FireOnceNow` misfire handling; Dashboard Agent restricts remote execution to registered Platform job types.                                                                                                                                                                                                                                                                                              | Missed intervals coalesce into a single catch-up run rather than replaying every missed tick; overlapping executions are blocked at the Quartz lock level.                                                                                                                           | <ResourceLink id="scheduler-service" type="service">scheduler-service</ResourceLink>, <ResourceLink id="ProcessVectorBatchIntegrationEvent" type="event">ProcessVectorBatchIntegrationEvent</ResourceLink>, <ResourceLink id="adr-002-scheduler-invocation-boundary" type="adr">adr-002-scheduler-invocation-boundary</ResourceLink>, <ResourceLink id="adr-003-idempotent-misfire-aware-jobs" type="adr">adr-003-idempotent-misfire-aware-jobs</ResourceLink>                                                                       |

## Safe Change & Verification Checklist

- Keep authoritative business state in its owning bounded context; never treat SMTP handoff or Notification telemetry as order status.
- Preserve unprefixed topic routing on [[channel|scheduler.process-vector-batch]] and `OrderId` partitioning on Finance notification commands.
- Keep SMTP credentials, HMAC keys, and connection strings in runtime secrets/parameters—never in source control or job definitions.
- Ensure customer email addresses and rendered email bodies remain redacted from logs and error payloads.
- Run `mise run format`, `mise run build`, and `mise run test` to verify Platform unit tests and Pact contracts (`Notification-Finance`, `Catalog-Scheduler`).

## Related Resources

- [[service|scheduler-service]] — Quartz.NET scheduler and outbox producer
- [[service|notification-api]] — Stateless Kafka-to-SMTP notification worker
- [[service|sendgrid-api]] — External SMTP relay provider
- [[flow|notification-delivery]], [[flow|product-ingestion]] — End-to-end delivery and ingestion workflows
- [[adr|adr-001-postgresql-quartz-persistence]], [[adr-003-idempotent-misfire-aware-jobs]], [[adr-003-notification-smtp-provider-boundary]], [[adr-005-notification-confidential-data-boundary]]
- [[doc|platform/006-api-and-contracts]] — Consolidated HTTP, gRPC, and Kafka contracts
