Compute and govern price changes across a large catalog, enforcing business rules and approvals, and propagate published prices to downstream contexts (catalog, search) reliably -- with safe rollout.
| Concern | Target |
|---|---|
| Price-change API latency | p99 < 150 ms |
| Rule evaluation correctness | 100% (no price published that violates a HARD rule) |
| Publish propagation | Catalog/search consistent within seconds (eventual) |
| Deploy safety | No pricing bug reaches >5% of stores before SLO gate (canary) |
| Availability | 99.95% |
- Pricing: owns proposals, rules, lifecycle. Aggregate:
PriceChangeProposal. - Catalog: owns the published price read model.
- Search/Index: owns discovery indexing (reacts to catalog updates). These map to MACH microservices; here they are packages sharing a process for demo simplicity.
- The approval lifecycle is orchestrated: a single state machine owns submit -> evaluate -> approve/reject -> publish. Complex, human-involved decisioning benefits from one authoritative flow (this is the Camunda BPMN / Temporal workflow role).
- The post-publish propagation is choreographed: catalog and search react to
PriceChangePublishedindependently with no coordinator. This decouples teams and scales across the org. The trade-off is that end-to-end visibility is harder, so we add a compensation path (PriceChangeRollbackRequested).
- Catalog of 50M SKUs; price changes are bursty (promotions, cost updates). Design for 5k proposals/sec peak during repricing events.
- Rule evaluation is O(rules) per proposal and CPU-bound; horizontally scalable (stateless).
- Publish fan-out goes to Kafka in production; partition by SKU for ordered per-SKU updates.
| Failure | Mitigation |
|---|---|
| Catalog update fails after publish | Choreographed compensation rolls the proposal back |
| Bad rule deploy | Canary + SLO gate auto-rollback |
| Approval never granted | Proposal stays PENDING_APPROVAL (no price leaks); SLA alerts |
| Duplicate publish | Idempotent catalog upsert keyed by SKU |
Actuator + Prometheus; track proposals by status, rule-violation rates, approval latency, and publish-to-catalog propagation lag.