Reference implementation of a governed pricing platform built on MACH principles and Domain-Driven Design. Demonstrates a pluggable rules engine, workflow orchestration for the price-approval lifecycle (Camunda/Temporal-style state machine) with human-in-the-loop, and a choreography-based SAGA with compensation across bounded contexts -- a deliberate contrast to the orchestration SAGA in
payments-modernization-platform.
Part of the Enterprise Platform Reference Architecture. Models the merchandising /
pricing domain. See docs/INDUSTRY-APPLICABILITY.md.
flowchart TB
api["POST /api/price-changes (API-first, headless)"] --> wf
subgraph pricing [Pricing context]
wf["PriceApprovalWorkflow (ORCHESTRATION state machine)"] --> rules["RuleEngine: margin / increase / competitive"]
end
wf -->|"clean"| pub["publish"]
wf -->|"soft violation"| hitl["PENDING_APPROVAL -> human approve"]
wf -->|"hard violation"| rej["REJECTED"]
hitl --> pub
pub -->|"PriceChangePublished event"| choreo
subgraph choreo [CHOREOGRAPHY across contexts]
cat["Catalog context updates read model"] -->|"CatalogUpdated"| search["Search context indexes"]
cat -->|"on failure: PriceChangeRollbackRequested"| comp["Compensation -> ROLLED_BACK"]
end
| Style | Where | Why |
|---|---|---|
| Orchestration | PriceApprovalWorkflow lifecycle |
Complex decisioning + human approval needs one owner of the flow (Camunda/Temporal) |
| Choreography | Post-publish catalog/search reactions | Loosely-coupled contexts react to events independently; scales org-wide |
Each rule is a Spring @Component implementing PricingRule, so adding governance is open/closed:
MinMarginRule(HARD: block below margin floor)MaxIncreaseRule(SOFT: large jump needs approval)CompetitiveRule(SOFT: materially above competitor needs approval)
mvn test # unit/integration tests
mvn spring-boot:run # http://localhost:8083
./scripts/demo.sh # walk the four scenarios
docker compose up --build- System design + SLOs
- Industry applicability
- Business & governance: BRD - SOP - NFR - Cost savings
- ADRs:
docs/adr/ - Canary rollout:
deploy/k8s/canary/
Java 21, Spring Boot 3.3, JPA/H2, Spring application events (choreography), Argo Rollouts (canary).